0

I have two P2P applications running, one in 10.7.1.1(A) and other in 10.7.1.3(B). It is kind of a chat application where each sends and receives only text messages and nothing else. Basically i am interfacing with 2 UDP sockets in both A and B for listening and sending texts. Currently i have hard-coded the port numbers in both systems to establish the sockets. Now how do i improve the same application by dynamically figuring out the port numbers to establish sockets? In other words i want the application to accept only IP address from the user and then establish a port on its own for socket connection? Can this design be achieved? What are the ways to do this?

user754740
  • 117
  • 2
  • 6

1 Answers1

0

You could register your port with some yet-to-be-described service, which would then allow your second instance to determine what port your first instance is listening on.

Or you could start listening on your hardcoded port, then as part of the initial handshake, switch to a dynamically generated port.

Neil
  • 54,642
  • 8
  • 60
  • 72