udp server cant send msg to client..? need help..!!
Closed this issue · 1 comments
public void send(String msg)
when msg is send from server, it gets receive in server itself.
Probably outdated, but here gos anyway:
It is true that in the example the server will send to itself for udp. The problem here is that the server sends and listenes on the same host/port combination. In reality you would usually run the client on a different machine than the server, thus would have a different host. If you want to run both server & client on the same device (as in the example) and want to send as well as receive data you basically have to two clients, one for sending and one for receiving, and two corresponding server, again one for sending and one for receiving, where each client/server combination is on their own port.
I've adjusted the example a bit, such that server can't send to client, thus making it a little les confusing.