the LAN from my NETMF device (GHI Electronics CANxtra). I am using the following code: IPHostEntry entry = Dns.GetHostEntry(ipAddress); IPAddress ipAddr = entry.AddressList[0]; IPEndPoint ep = new IPEndPoint(ipAddr, portNo); commSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); commSocket.Connect(ep); The 3 minutes then thrown exception 10035. Am I missing something simple here? .NET Microframework Discussions IPHostEntry (1) IPEndPoint (1) AddressFamily.InterNetwork (1) IPAddress (1) SocketType.Stream (1) SocketException (1) ProtocolType (1) GetHostEntry (1) Isn't firewall blocking the
in a class that I got from the web - my question is below the source. IPHostEntry hostadd = Dns.GetHostEntry(server); IPEndPoint EPhost = new IPEndPoint(hostadd.AddressList[0], port); Socket socket = new Socket(EPhost.Address.AddressFamily, SocketType.Dgram, ProtocolType.Udp socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeoutSendingToServer); socket.SendTo(messageSend, EPhost); IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0); EndPoint tempRemoteEP = (EndPoint)sender; socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeoutReceivingFromServer); int numBytesReceived So first of all the server's IP address and port are combined into an IPEndPoint - no problem. Then the Socket is created using that IPEndPoint, a timeout added and the data is sent using SendTo - no problem. Now comes the
and client The server use sockets over tcp: Something like this: Private Function setUpSocketServer() As IPEndPoint Dim ipHostInfo As IPHostEntry = Dns.Resolve(Dns.GetHostName()) 'The DNS name of the computer Dim ipAddress As IPAddress = ipHostInfo.AddressList(0) Dim localEndPoint As New IPEndPoint(ipAddress, GetNextPort) 'port 11000 ' Establish the local endpoint for the socket. Return localEndPoint End Function Private Sub StartListening() Dim localEndPoint As IPEndPoint = setUpSocketServer() Dim listener As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) ' Intializes a TCP
and client The server use sockets over tcp: Something like this: Private Function setUpSocketServer() As IPEndPoint Dim ipHostInfo As IPHostEntry = Dns.Resolve(Dns.GetHostName()) 'The DNS name of the computer Dim ipAddress As IPAddress = ipHostInfo.AddressList(0) Dim localEndPoint As New IPEndPoint(ipAddress, GetNextPort) 'port 11000 ' Establish the local endpoint for the socket. Return localEndPoint End Function Private Sub StartListening() Dim localEndPoint As IPEndPoint = setUpSocketServer() Dim listener As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) ' Intializes a TCP
other system by IP address in C#.net window application as follows / / Synchronous connect using IPAddress to resolve the / / host name. public static void Connect1( string host, int port) { IPAddress[] IPs = Dns.GetHostAddresses(host); Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Console Follow this example- server side code: namespace Consoleserver { class Program { static void Main(string[] args) { IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000); Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); try { listener.Bind(localEndPoint