UDP Connection

G

Guest

Hi,

I need help on this one. Any help would be appreciated. Im doing a
UDP client - server connection. I want a client with only one instance of the
UDP and binds the port to do both sending and listing. And have a server with
2 instances one for sending and one for listening which is binded to the
port.. Will this work? Is this possible? Can i bind the client and still have
it listen?
Does anyone know how to do this type of connection? Any help would
be appreciated. Thank you so much in advance.
 
P

Peter Duniho

Rain said:
I need help on this one. Any help would be appreciated. Im doing
a
UDP client - server connection. I want a client with only one instance of
the
UDP and binds the port to do both sending and listing. And have a server
with
2 instances one for sending and one for listening which is binded to the
port.. Will this work? Is this possible?

If by "instance" you mean an instance of a Socket class with a given bound
address then the answer is "sort of".

You will have to enforce your desired behavior yourself, but in Winsock you
can create multiple sockets with the same port on the same network adapter
by using the SO_REUSEADDR option. If I recall correctly, the .NET Socket
API does provide the ability to set socket options, so this feature should
be available to you in .NET as well.

I can't say that I think it's a really good idea to do so, but it is
technically possible.
Can i bind the client and still have it listen?

This part I don't understand. Do you want your client to be using the same
port number and network adapter as the server? IMHO, this is even a worse
idea than having the server create multiple sockets with the same port
number. You can do it (with the same socket option as above), but surely no
good can come from doing so. :)

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top