Networking - System.Net.Sockets.Socket.Connect(System.Net.EndPoint remoteEP) works for Windows CE 4.2 but not Windows CE 5.0

Asked By Shane Kercheval
16-Dec-08 02:33 PM

IPAddress ipAddress = Network.GetServerIP(host);

IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, port);

m_ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

m_ClientSocket.Connect(ipEndPoint); //throwing exception

-this works on a Windows CE 4.2 device but not a Windows CE 5.0 device (the devices are slightly different but it "should" not have anything to do with that)

-verified "Network.GetServerIP(host)" is returning the correct ip address and i'm using the correct port.

-verified the device can connect to internet

-verified windows ce 4.2 device can connect to server, i.e. open a socket.

-set logs on the server and server doesn't log anyone trying to connect when using ce 5.0 device

-message i'm recieving in generic exception is more or less "server refused connection" (very vague)

-the ce 4.2 device is a company specific device that no one will be familiar about and the ce 5.0 device is a similar newer conpany specific device.

-please first think about anything different between Windows before stating possible differences in devices

I believe this is a typical port problem  I believe this is a typical port problem

17-Dec-08 06:02 AM

it is not the code or the device.

Please check the port.

I am sure that both the devices dont use the same port.

the port is the port of the server your trying to connect to. should be the same regardless of device.  the port is the port of the server your trying to connect to. should be the same regardless of device.

17-Dec-08 11:37 AM
end of post

I mean the port thru which you are trying to send the message to the server.  I mean the port thru which you are trying to send the message to the server.

18-Dec-08 12:57 AM
end of post
Create New Account
help
command Socket.BeginConnect, start behave in a Synchronous !!!! mode. Here some code: try { _CountPackets = 0; IPAddress ipAddress = Dns.GetHostEntry(IpServer).AddressList[0]; _IpEndpoint = new IPEndPoint(ipAddress, PortServer); _ClientSocket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IAsyncResult asyncConnect = _ClientSocket.BeginConnect( _IpEndpoint, new AsyncCallback(ConnectCallback), _ClientSocket); } catch (Exception exc) { CloseSocket(); } The Does any one know what is all about ? thanks .NET Framework Discussions Windows XP (1) IPEndPoint (1) AddressFamily.InterNetwork (1) ClientSocket.BeginConnect (1) IAsyncResult (1) IPAddress (1) Socket.BeginConnect (1) SocketType.Stream (1) Hello, how do you check whether beginconnect runs
System.Net.Sockets class .NET Framework Hi, I have created a socket like this: ipAddress = ipAddress.Parse(strAddress) ipRemoteEP = New IPEndPoint(ipAddress, nPort) m_Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) m_Socket.BeginConnect(ipRemoteEP, AddressOf ConnectCallback, m_Socket) and that all works fine (ie. the ConnectCallBack the remote server disconnects (crashes / shuts down / closes the connection / etc)? Thanks, Alain .NET Discussions IPEndPoint (1) AddressFamily.InterNetwork (1) System.Net.Sockets (1) Socket.BeginConnect (1) SocketType.Stream (1) ConnectCallback (1) ProtocolType (1) BeginConnect (1) You do not. . . That's because that is how tcp / ip is Shelton keywords: System.Net.Sockets, class description: Hi, I have created a socket like this: ipAddress = ipAddress.Parse(strAddress) ipRemoteEP = New IPEndPoint(ipAddress, nPort) m_Socket = New Socket(Addr
packet to the local PC? .NET Framework Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); / / ServerPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 50000); / / <- --(1) This has no effect. ServerPoint = new IPEndPoint(IPAddress.Parse("100.1.2.3"), 50000); / / <- --(2) This works. int sent = s.SendTo(new byte port for both client / server), my public IP address instead of 127.0.0.1, IPAddress.Loopback, Dns.GetHostByName("localhost"), etc but the result was the same. Thank you for any hint. C# Discussions SocketOptionName.UseLoopback (1) IPEndPoint (1) AddressFamily.InterNetwork (1) SocketOptionLevel.Socket (1) IPAddress.Loopback (1) SocketOptionLevel (1) SocketOptionName (1) IPAddress.Parse (1) ddressFamily.InterNetwork, SocketType.Dgram, ndPoint(IPAddress
communication. I set up my server socket: Socket s = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); IPEndPoint ep = new IPEndPoint( IPAddress.Any, 0 ); s.Bind( ep ); int port = ep.Port; The server socket's computer name clients retrieve them to connect as follows: Socket sClient = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); IPAddress ipAddress = Dns.GetHostEntry( computerName, port ).AddressList[0]; IPEndPoint ep = new IPEndPoint( ipAddress, port ); sClient.Bind( ep ); When I run the server socket application