472,981 Members | 1,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,981 software developers and data experts.

Determine dynamically assigned port of accepted server socket

After a server accepts a client connection on a certain port, a new socket is
created on the server on a system managed dynamic port to handle the
connection. Please confirm this.

If so, how can I get the number of the dynamic port in the server (in server
code)? Using LocalEndPoint.Port just returns the original listener port
number.

Thanks,

Jason
Jul 27 '05 #1
5 3980

http://msdn.microsoft.com/library/de...pointtopic.asp
Erick Sgarbi
After a server accepts a client connection on a certain port, a new
socket is created on the server on a system managed dynamic port to
handle the connection. Please confirm this.

If so, how can I get the number of the dynamic port in the server (in
server code)? Using LocalEndPoint.Port just returns the original
listener port number.

Thanks,

Jason

Jul 28 '05 #2
No, I don't need the client's port number, I need the server's new port
number for that instance socket.

Jason

"er***@csharpbox.com" wrote:

http://msdn.microsoft.com/library/de...pointtopic.asp
Erick Sgarbi
After a server accepts a client connection on a certain port, a new
socket is created on the server on a system managed dynamic port to
handle the connection. Please confirm this.

If so, how can I get the number of the dynamic port in the server (in
server code)? Using LocalEndPoint.Port just returns the original
listener port number.

Thanks,

Jason


Jul 28 '05 #3
Hi,

"Jason" <Ja***@discussions.microsoft.com> wrote in message
news:6D**********************************@microsof t.com...
After a server accepts a client connection on a certain port, a new socket
is
created on the server on a system managed dynamic port to handle the
connection. Please confirm this.
No, that's not true. It creates a new Socket but keeps using the same port.
A TCP server can have multiple client connections to the same port.
HTH,
Greetings

If so, how can I get the number of the dynamic port in the server (in
server
code)? Using LocalEndPoint.Port just returns the original listener port
number.

Thanks,

Jason

Jul 28 '05 #4
Well then how does the server (underneath) resolve which socket steam should
recieve incoming packets? I thought this was done by creating the instance
socket on the server with a new port in the system managed dynamic port range.

Thanks,

Jason

"Bart Mermuys" wrote:
Hi,

"Jason" <Ja***@discussions.microsoft.com> wrote in message
news:6D**********************************@microsof t.com...
After a server accepts a client connection on a certain port, a new socket
is
created on the server on a system managed dynamic port to handle the
connection. Please confirm this.


No, that's not true. It creates a new Socket but keeps using the same port.
A TCP server can have multiple client connections to the same port.
HTH,
Greetings

If so, how can I get the number of the dynamic port in the server (in
server
code)? Using LocalEndPoint.Port just returns the original listener port
number.

Thanks,

Jason


Jul 28 '05 #5
Hi,

"Jason" <Ja***@discussions.microsoft.com> wrote in message
news:C7**********************************@microsof t.com...
Well then how does the server (underneath) resolve which socket steam
should
recieve incoming packets?
When there are multiple connections to the same server ip and server port ,
then either the client's ip or client's port is different or both.
Underneath it not only uses server ip and port but also client ip and port
to resolve the right Socket.
I thought this was done by creating the instance
socket on the server with a new port in the system managed dynamic port
range.
No, it's not, if you use windows you can use the commandline tool 'netstat'
to see that the _same_ server port is used when you have accepted a number
of connections.

For detailed explaining i can only recommend reading the RFC's about the TCP
protocol.

hth,
Greetings

I thought this was done by creating the instance
socket on the server with a new port in the system managed dynamic port
range.

Thanks,

Jason

"Bart Mermuys" wrote:
Hi,

"Jason" <Ja***@discussions.microsoft.com> wrote in message
news:6D**********************************@microsof t.com...
> After a server accepts a client connection on a certain port, a new
> socket
> is
> created on the server on a system managed dynamic port to handle the
> connection. Please confirm this.


No, that's not true. It creates a new Socket but keeps using the same
port.
A TCP server can have multiple client connections to the same port.
HTH,
Greetings
>
> If so, how can I get the number of the dynamic port in the server (in
> server
> code)? Using LocalEndPoint.Port just returns the original listener
> port
> number.
>
> Thanks,
>
> Jason


Jul 28 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dana Marcusanu | last post by:
Yes. I want to write a very small web sniffer that gets data from a specified port. I already looked at some of the existing ones on Internet, but they are not in Python (I am trying to learn...
4
by: anketm | last post by:
I am writing a simple client using UDP sockets. I am wondering if there is any way to determine what local port a socket was bound to when bind() is not explicitly called. This is what my...
5
by: Jason | last post by:
After a server accepts a client connection on a certain port, a new socket is created on the server on a system managed dynamic port to handle the connection. Please confirm this. If so, how...
6
by: Marc | last post by:
How could I directly trigger a very simple on localhost and a known port listening server from my internet browser client? Local host means the little server would be running on the client machine,...
7
by: Sharon | last post by:
Hi all, I've implemented a TCP server using the Socket async methods. When connecting to the server from 3 instances of hyper terminal, i've noticed that each of the newly created server sockets,...
2
by: jasonsgeiger | last post by:
From: "Factor" <jasonsgeiger@gmail.com> Newsgroups: microsoft.public.in.csharp Subject: Multiple Clients, One port Date: Wed, 19 Apr 2006 09:36:02 -0700 I'm been working with sockets for a...
15
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello everyone, I have this code for TCPListenPort. The code works fine, but my manager is asking me to establish multiple connections to the same port. How can i acheive that below is my...
3
by: Giampaolo Rodola' | last post by:
Hi there, since the socket.socket.family attribute has been introduced only in Python 2.5 and I need to have my application to be backward compatible with Python 2.3 and 2.4 I'd like to know how...
1
by: kash123 | last post by:
Hi All, I have written an application, a part of which, in the application, is a socket server programe accepting connection requests from socket clients. My server code typically contains, ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.