Create New Account
help
error I'm receiving exception while trying to connect to another peer by using following code Private _IpEndPoint As New _ IPEndPoint(IPAddress.Parse( "192.168.16.8" ), 5124) _ClientSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp
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 Firstly I know Socket should be in a 'using' clause, I have removed that and error checking so that the code I have posted is just the barebones. 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
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.Parse("127.0.0.1"), Point(IPAddress
code class FTClientCode { public static string curMsg = " Idle" ; public static void SendFile( string fileName) { try { IPAddress[] ipAddress = Dns.GetHostAddresses( " localhost" ); IPEndPoint ipEnd = new IPEndPoint(ipAddress[ 0 ], 5656 ); / * Make IP end point same as Server. * / Socket clientSock = new Socket(AddressFamily.InterNetwork transfer data. Then extract the at the peer side. This way you save: • Implementing an error-prone recursive pattern. • Your bandwidth Good explanation on different types of serialization: http: / / www.dotnetspider take care. Hope you understood. HI I have done as u said but getting following error The type or namespace name 'Folder' could not be found (are you missing a using you. hi I really thanks for your support but still i am getting the same error I have included following header files using System; using System.Collections.Generic; using System.ComponentModel
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 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 on the Vista machine