470,624 Members | 2,276 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

Multiple local ports in system.net.sockets class

Hi

Not sure I can do what I'm trying to do without using a 3rd party
component like Dart. I need to build a windows service to create a
socket connection on an IBM mainframe using an IP and port
combination. No problem there.
However, due to the expected volume (at least 20x10K streams per
second in each direction), the mainframe sysadmin has requested the
service use multiple 'conversations' within the single IP connection.
The easiest way to do this is use different local ports when we open
the connection (Dart's component allows this), but I cannot find
anything within the .Net socket class which appears to support the
setting of a local port when opening a connection. Can this be done in
C# using the sockets class?

Thanks

John

Apr 3 '07 #1
1 3482
On Tue, 03 Apr 2007 12:40:51 -0700, jcprince <jc******@gmail.comwrote:
[...]
However, due to the expected volume (at least 20x10K streams per
second in each direction), the mainframe sysadmin has requested the
service use multiple 'conversations' within the single IP connection.
The easiest way to do this is use different local ports when we open
the connection (Dart's component allows this), but I cannot find
anything within the .Net socket class which appears to support the
setting of a local port when opening a connection. Can this be done in
C# using the sockets class?
At the face of it, your question doesn't make much sense.

First, there's no such thing as an "IP connection". IP is a low-level
protocol on which TCP and UDP are implemented, and like UDP the IP
protocol is connectionless. So, let's assume you really mean "TCP
connection".

Second, using a different local port will by definition require a new TCP
connection. A TCP connection is uniquely identified by the two endpoints
IP address and port. A single TCP connection can only have a single port
at each end.

As far as defining the port used in .NET, once a Socket has been bound to
an address, that's its address. It can only have one address (IP address
plus port). You can use the Bind() method to specify the port explicitly,
or the port will be automatically assigned from the range of unused ports
when you connect the socket to a remote endpoint. But either way, the
Socket can only have one port assigned to it.

Finally, the way you've worded your question, you are limiting the
most-specific replies to coming from people who know what "Dart" is.
Knowing what "Dart" is is not a prerequisite to knowing how to use .NET
Sockets, and so you are unnecessarily limiting your potential audience by
comparing your problem to something "like Dart".

It would be better if, rather than just saying "like Dart", you explain
what "Dart" is and what specifically it does that you would like to be
able to do in .NET. I can tell you for sure that "Dart" in and of itself
cannot provide a way to use multiple local ports on a single TCP
connection, because that's a limitation of TCP. But other than that, I
can't really compare the behavior of "Dart" to what .NET can or cannot do.

If the above doesn't answer your question, you may want to rethink how to
describe what it is you're actually trying to do and what information
specifically it is you need.

Pete
Apr 3 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jim Kipp | last post: by
reply views Thread by nezoat | last post: by
7 posts views Thread by Sharon | last post: by
2 posts views Thread by jasonsgeiger | last post: by
27 posts views Thread by cmdolcet69 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.