Need help with LAN Networking

DerFubel

Member
Hi, I'm trying to implement a feature with which each client can search for servers within the local network, so I'm making a server list before the actual server-client-connection is set up. My system works like this:

1) First the client sends a buffer using network_send_broadcast.
2) The buffer is received by the server, the server uses a) a server (tcp) to handle normal data traffic once the client is connected and b) a socket (created with network_create_socket_ext to detect the initial call from the client)
3) The server should then respond to the client by sending back a buffer which contains information that the client then uses to join the server (directly to the tcp server)

Step 1) and 2) are executed without any problems, but I can't figure out how I should code step 3.

And that's the problem. I don't know how I can send back data from the server to the client. Do I really need to set up a third "channel" using network_send_broadcast and network_create_socket_ext? Or is there a simple way to send data from my server object to the client object, withtout establishing a direct connection? This really confuses me :(
 

chamaeleon

Member
Hi, I'm trying to implement a feature with which each client can search for servers within the local network, so I'm making a server list before the actual server-client-connection is set up. My system works like this:

1) First the client sends a buffer using network_send_broadcast.
2) The buffer is received by the server, the server uses a) a server (tcp) to handle normal data traffic once the client is connected and b) a socket (created with network_create_socket_ext to detect the initial call from the client)
3) The server should then respond to the client by sending back a buffer which contains information that the client then uses to join the server (directly to the tcp server)

Step 1) and 2) are executed without any problems, but I can't figure out how I should code step 3.

And that's the problem. I don't know how I can send back data from the server to the client. Do I really need to set up a third "channel" using network_send_broadcast and network_create_socket_ext? Or is there a simple way to send data from my server object to the client object, withtout establishing a direct connection? This really confuses me :(
If you want to accept incoming data by UDP or TCP, you need to have create a socket of that type, even if your program is a "client". Your server will inspect the incoming broadcast message, make note of the IP it came from, and send a UDP message back or create a TCP connection in the client. In either case, you need to have your client listen on a socket for these incoming messages or connection attempts.
 
Top