Unix Programming - bind() ing to bound ports ...

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > bind() ing to bound ports ...





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 bind() ing to bound ports ...
John Galt

2004-01-23, 5:36 pm

Hi folks ...

I have an application that needs to:
- receive UDP pkts on a specific port
- those UDP pkts must be coming from a specific server/port
(the port may be taken)

To test this app, I did the following:

- connected (via ssh) to the server; this set up a connection
like this:

1.1.1.1:1665 <--> 2.2.2.2:22

- started a server on 1.1.1.1:2000 to listen for
pkts from 2.2.2.2:22 (Note that the port 22 is deliberate,
I wanted to check if it would work this way.)

- started a client on 2.2.2.2 that sent pkts to the server
on 1.1.1.1:2000; the pkts were to be marked as coming from
port 22. But this failed - bind() gives "Permission Denied" -
I am guessing because my TCP ssh connection has already
taken that port.

My questions:
- If a port is bind()-ed over TCP, then will future UDP socket
bind() requests fail? If yes, then how does sshd work - i.e.
many clients can connect to port 22, don't all those outgoing
packets have port 22 as the source port?
- Is there another way to send out UDP datagrams to a given
IP:port such that the datagrams can "originate" from a port
that may already be taken up by another TCP or UDP server?

TIA,
John
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com