473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 4000

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.