|
Home > Archive > Unix Programming > March 2007 > Specifying send port for client
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Specifying send port for client
|
|
| Madhur 2007-03-15, 1:25 am |
| Hi All,
I am writing a small client/server program. I have a peculiar
requirement that the client program while sending the data to the
server has to send the data from the user defined port. But the thing
what i have observed is that the client binds to some random ephemeral
port before sending the data. I could not find any option that i can
set for the client program to bind to port to some predefined value.
The kernel always picks from the set of random ports.
I would like to know, if there is any option, so that i can mandate
the client program to send the data through a predefined port. As
there is a option in listen() for server, to listen on a particular
predefined port.
Thanks,
Regards,
Madhur
| |
| Bin Chen 2007-03-15, 1:25 am |
| On Mar 15, 12:24 pm, "Madhur" <madhurr...@gmail.com> wrote:
> Hi All,
>
> I am writing a small client/server program. I have a peculiar
> requirement that the client program while sending the data to the
> server has to send the data from the user defined port. But the thing
> what i have observed is that the client binds to some random ephemeral
> port before sending the data. I could not find any option that i can
> set for the client program to bind to port to some predefined value.
> The kernel always picks from the set of random ports.
>
What is your 'bind' mean, it means the system do the binding for you
or you explicitly call bind() before you send the data?
If you do not call bind(), do it.
> I would like to know, if there is any option, so that i can mandate
> the client program to send the data through a predefined port. As
> there is a option in listen() for server, to listen on a particular
> predefined port.
>
> Thanks,
>
> Regards,
> Madhur
|
|
|
|
|