So if the Computer A is a Server and Computer B is a client then there is no issue they can communicate is also a computer in a LAN and that LAN is accessing Internet via router who uses a public IP Adress. Lets name who is in a LAN, and in same LAN. When you do socket programming on LAN as you are doing here it is pretty fine, any server can be hosted on any LAN computer and any client can initialize connection and can start communications, because they are in same home (for ease to say) They all know each other very well, but if you want to communicate some other computer which is outside the network then there are some issues, Ī Client: The one who connects to server to gain some service and initialize connection with server Lets Define some term here so it would be better to understant what i actually want to sayĪ server: The one who serves the request. There are some points to remeber for that. If i am not wrong you want to make a chat messenger type application that can work over internet just like gtalk, yahoo, or other IM messengers do ? use the ipaddress as in the server programĬonsole.Write( " Enter the string to be transmitted : ") Ĭonsole.WriteLine( " Transmitting.") if i replace it with WAN IP it does not communicate. S.Send(asen.GetBytes( " The string was recieved by the server.")) Ĭonsole.WriteLine( " \nSent Acknowledgement") Ĭonsole.WriteLine( " Error. * Start Listeneting at the specified port */Ĭonsole.WriteLine( " The server is running at port 8001.") Ĭonsole.WriteLine( " The local End point is :" Ĭonsole.WriteLine( " Waiting for a connection.") Ĭonsole.WriteLine( " Connection accepted from " s.RemoteEndPoint) ![]() TcpListener myList= new TcpListener(ipAd, 8001) use local m/c IP address, and // use the same in the client /* Initializes the Listener */ ![]() Copy Code // /* Server Program */ using System
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |