I am trying to set up a shared folder with an old Win CE 5.0 device I am using to learn and improve my C# skills.
Possible options to do this can be done via console: net use sharedfolder \\mypc /user:foo /password:bar, to start an extra process from my C# application which then runs the console with the previous parameters or by using the function WNetAddConnection3.
However, I receive every time Error 53, ERROR_BAD_NETWORK_PATH.
I have checked the connection, as well as the path - always error 53.
A connection between another PC and \\mypc works fine without any problems. By comparison of my PC's network connection with the Win CE 5.0 device I have found out that there is only one difference: the Win CE 5.0 device has one WINS-server less. After setting the IP profile manually (IP Address, Subnet Mask, Default Gateway, DHCP, WINS), as well as adding the missing WINS-server, the problem disappears and the folder has been mounted successfully.
How can I fix this problem without changing the IP profile by hand?
In a normal network the WINS will be set by the DHCP server. The WINS entry of a network connection can also be set manually.
The problem with network sharing on Windows Mobile (WM) and Windows CE (WCE) is that it does not allow IP addresses, it only accepts windows network names. If you do not have WINS, a netbios network name can be resolved by the network card using a hosts entry, a broadcast or a WINS server.
As you do not have access to the DHCP settings of ActiveSync, you can either set WINS manually or by code or simply add a host entry for the connected PC. The activesync connected PC will can act as WINS server or , when you enter the netbios name for the netbios share server, the device can simply translate the netbios name to an IP. So either use the activesynced PC or the netbios server IP address as a WINS entry or add the name and IP of the sharing PC to the WCE/WM hosts table (registry: http://windowsmobilepro.blogspot.de/2006/04/etchosts-file-equivalent-in-windows.html).
[HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts\hello]
"ipaddr"=hex:a1,a3,a5,a9
"ExpireTime"=hex:99,99,99,99,99,99,99
I recommend to use the hosts entry solution and enter the name to use and the IP of the server you want to use.
Related
Context:
I have a C# application that works with a scanner, on a Windows 10 environment.
In some situation, users would, from their local computer, connect to a remote computer that is running the application.
The application shows a list of scanners that are available, both local and remote.
I need the application to be able to identify whether a scanner is local (connected to the computer the user is on) or remote (connected to the computer on which the application is running).
What I have tried:
Using the DeviceManager object from the WIA library, I am able to get a list of properties (DeviceInfo.Properties) from each device connected to the computer.
One property, PnP ID String, always displays "&rev" for remote scanners.
Example of PnP ID String for a local scanner:
For a remote scanner:
This behavior has been observed with several scanners from different brands (namely Fujitsu, HP).
The "tsusb-session" string found for the remote scanner looked intersting in the first place but is absent when testing with HP scanners.
Also, one of the properties that is recovered is Remote Device ID, but it is always displayed blank.
Is the "&rev" thing a reliable way to identify a remote device ?
If not, is there an accurate way to do it ?
Scenario: I have a small POS system running in a brick-and-mortar store. The software is running in Windows machines with SQL Server 2008 - 2012 (it varies). There are Android tablets that need to connect to the server in someway to get the data inside SQL Server.
My plan right now is to create some REST Web services using NancyFx and host them as a Windows Service inside the Windows machines. Then the Android tablets will need to connect to the server via HTTP in order to consume the REST API.
I have a problem (perhaps more than one): the network in the brick-and-mortar store is not that reliable and the Wi-Fi signal might decrease for whatever reason.
Question: Is there a way to automatically find the IP or machine name of the server (the one with the REST API) even if these properties change for some reason (unknown network issues or so)?
Yes, the server and the tablets are going to be on the same local network.
it's more of a network problem than programming issue. you must have a DHCP server installed in your LAN. use that to assign an IP to the server with a fixed lease. that way you fix the address of server. clients should preferably connect to that server using its name. since it's a Windows network, name would resolve to the ip address.
that is the simplest solution i can think of
I created a very simple application just to test out if I could create an app and then put it on another computer and hit the database on my other computer. I can enter data into my database on the computer that hosts the SQL Server just fine, but on my other computer I get the error message
Provider: Named pipes Provider, Error 40, could not open a connection to SQL Server
I've done everything on this link and googled and tried troubleshooting a ton. I am using SQL Server 2017 and VS 2017. Is it something wrong with the host computer or the other computer?
I tried troubleshooting with this link and after I got to the part about pinging the computer I can't ping the host computer using the other computer and using the other computer I can't ping the host computer. Both ways pinging wouldn't work, but the information on how to troubleshoot that wasn't very good.
I found something may be helpful from google...
According to users, if you're unable to ping other computers, the issue might be related to your network. To fix the problem, be sure that your PCs are properly connected and able to access the Internet. In addition, you might want to try restarting your network devices and check if that solves the issue
https://windowsreport.com/windows-10-unable-to-ping-other-computers/
For this you need to:
1. Enable access through firewall
2. Specify a port to connect to the computer hosting the database.
3. Make sure you are on the same network and can connect each other via localhost. If you cannot access via the default 127.0.0.1, try connecting by the ip address of the computer that is hosting your database.
If proper firewall access and ip config are not maintained, you will not be able to connect to the DB. It is appropriate running a REST server configuration on the host machine to allow access to the data through API requests rather than direct access to the SQL database.
Hi,
I had same problem while connecting sql server via developement
server.
In my case there was a problem with sql port (1433) blocked from
firewall.
Please do below given steps to check the same in your machine.
I hope it will work for u.
1 > open cmd and ping your server IP
for example
c:\System32>ping 192.168.1.45 -t
2> check sql port(1433) is open for your sql sever by using telnet
for example : telnet server IP port Number
c:\System32> telnet 192.168.1.45 1433
3 > if telenet failed... then use below command to open the port OR
contact your network team.
c:\System32> netsh firewall set portopening protocol = TCP port = 1433 name =
SQLPort mode = ENABLE scope = SUBNET profile = CURRENT
I am trying to communicate with comms from a server to a client on the same PC. So if I send the word "Hello" from one it appears on the other like a chat program. As I am on one PC I set IP to 127.0.0.1 and port to 7000 although port could be lots of other numbers. When I press to connect it will not connect to local host.
On XP laptop all is OK so something in set-up is not good. I looked at opening Firefox and typed in Local Host it works, tried 127.0.0.1 it works so IIS is working BUT that is not what I want. I looked for files with local host in and find in C:\Windows\System32\drivers\etc a file called hosts with 127.0.0.1 and IPv6 version ::1 commented out. Uncommented and still nothing works.
Switched off firewall still no good, switched off Virus detection still nothing.
What have I missed how can a chat program talk on loopback in Win7?
I'm not sure if you are intentionally typing in Local Host separately. The host "localhost" is what you are after, followed by the appropriate port number.
Example:
http://localhost:7000/url_to_chat
If you have been doing that correctly, then you just need to define two different ports for each app if you are running both on the same machine in Windows 7 and done.
If you are using Visual Studio's IIS Express (recommended as you don't have to run as an admin), all you have to do is specify the port number and create the folder. You'll then have to run each app.
Hope that helps.
Try this site for information on how to change your hosts file:
https://bowerwebsolutions.com/how-to-edit-your-local-host-file-for-testing-web-sites/
This has been one annoying piece of needle in a haystack.
The C# application is practically complete and I need to test the cooperation of two or more different machines on the same network, to see if they display the same data from the database.
When I run SQL Server + Visual Studio together during development, there's no problem, I use this connection string and everything works OK:
'#"Data Source=PCNAME\SQLEXPRESS;Initial Catalog=POS;";'
I have now published the app and installed it on another machine that happens to be on the same network. Obviously the connection string will not work on that machine because its name is not PCNAME, it's 2NDPC.
But I doubt the answer is to open the solution, edit the cnx string and re-publish for each machine. Even then, how will they be using the same database?
TL;DR
**What I need **
I want to use the machine I developed the application on initially to be hosting the database, to which the local machines can connect.
I've tried forwarding 1434 port and making rules, I've tried starting tcp/ip process in Server Configuration and making sure SQL Browser Agent Service or what not is running.
But no, I either get and error#25 or nothing happens.
Please help and tell me in explicit steps how I can achieve this goal.
1) Enable TCP/IP in the SQL Server Configuration Manager
2) Make sure SQL Server Browser is running, if not, start it, if you can't, right click > properties > service tab > Start Mode = "Automatic"
This is what (excluding people recommending firewall solutions, different programs/sites and downloading stuff to achieve this) I was missing, that nobody managed to tell me.
So .. depending on what you've been doing recently, you may or may not have changed some default values here and there. I'm not too sure if this is default, or if it happened with my win10 upgrade, but either way this worked.
3) In SQL Server Configuration Manager, right click on your TCP/IP item, hit properties, swtich to the ip addresses tab and put in 1433 in the tcp port field under IP1 and IPALL
Instead of pcname, try using TCP/IP address. PCNAME is Netbios dependant. You also need to make firewall adjustments, make sure SQL server is allowed for remote connections and listening on correct port (although 1433 is the default port, you are not guaranteed to have the correct instance on that port).
I have created and published a four part video series on this subject. Although it is about installing our application, 3 out of 4 parts deal with installing SQL server on the host, configuring it for remote access and accessing from clients. Check if you wish, here is the link to the 1st one:
AccuSQL Installation part 1
You need to load your connection string from a configuration file and on publish run a first run wizard or something similar to set the connection string the first time.
To get your 2NDPC to connect, all you'd need to use is the DNS name of the PC and it should work. You may also need to set SQL Server to allow connections on TCP/IP in SQL Configuration Manager.
Also FYI seeing your comment about using IP addresses, you're doing it right, but you don't use \\ in front of the IP. Just replace your PC name with the IP address. EG:
Data Source=192.168.0.1;Initial Catalog=MyDB; ...