General issue handling public/private IPs on the developing of a socket server
this is a general question, so no specific programming lenguage is envolve.
Im developing a chat server were my users log in using any of my clients applications with a very simple implementation of the TCP protocol.
When the user logs into, the client sends a raw text to the server indicating some parameters like username, others, and the most i开发者_StackOverflowmportant the WAN ip. This data gets stored on ther server database. After the execution of a algorithm who search for other online user in the database, the server sends to a pair of users the ip and the username of the other user, so later the clients can connect to each other directly wihtout using the server anymore.
So, the server acts only like a meet point. Well all this works fine is the users arent inside of a private network, like a wireless router. I really dont know how to solve this problem, so any help you guys can give will be appreciated. And sorry about my english.
If this is of any help, the clients are programed in AS3 using XMLSocket and the server using VB6 with winsock.
There is no need for the client to send his own WAN address. The server can query it from the connection. For example, see the accept function in the Win32 documentation. I looked up the VB6 Winsock Accept function and it didn't seem to expose the same functionality, but there is probably another way to do it in VB6. All the languages I know do.
精彩评论