473,387 Members | 1,611 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,387 software developers and data experts.

socket maxconnections?

Ole
As a newbie to socket communication I would like to know more about
'SocketOptionName.MaxConnections'. Everywhere I look for examples on using
socket I see the statement:
listenSocket.Listen((int)SocketOptionName.MaxConne ctions);
used , but the .NET documentation says this about Maxconnections: "Not
supported; will throw a SocketException if used."
What should I do and what is the code line actually doig?

Thanks
Ole
Aug 22 '06 #1
4 8086
Hello, Ole!

OAs a newbie to socket communication I would like to know more about
O'SocketOptionName.MaxConnections'. Everywhere I look for examples on
Ousing socket I see the statement:

OlistenSocket.Listen((int)SocketOptionName.MaxConn ections);

Line above means that listenSocket state will be changed to LISTENING ( it will accept connections via Accept method ). And number of pending connections is equal to SocketOptionName.MaxConnections.

SocketOptionName.MaxConnections has the same value as int.MaxValue has ( 0x7fffffff ).

Exception will be thrown when you will try to set socket option and use MaxConnections as an option name, e.g.
listenSocket.SetSocketOption(..., SocketOptionName.MaxConnections, .... );

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Aug 22 '06 #2
Ole
Thanks. Still not sure what the number is actually good for: what would
happen if I wrote 1 instread of MaxConnections?

Best regards,
Ole
"Vadym Stetsyak" <va*****@ukr.netwrote in message
news:eN**************@TK2MSFTNGP02.phx.gbl...
Hello, Ole!

OAs a newbie to socket communication I would like to know more about
O'SocketOptionName.MaxConnections'. Everywhere I look for examples on
Ousing socket I see the statement:

OlistenSocket.Listen((int)SocketOptionName.MaxConn ections);

Line above means that listenSocket state will be changed to LISTENING ( it
will accept connections via Accept method ). And number of pending
connections is equal to SocketOptionName.MaxConnections.

SocketOptionName.MaxConnections has the same value as int.MaxValue has (
0x7fffffff ).

Exception will be thrown when you will try to set socket option and use
MaxConnections as an option name, e.g.
listenSocket.SetSocketOption(..., SocketOptionName.MaxConnections, .... );

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com

Aug 22 '06 #3
Hello, Ole!

That will mean that number pending connections will be equal to 1.
That is if there are a lot hosts that want to connect connection queue's size will be 1, thus
some hosts will be refused connection.
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Aug 22 '06 #4
Ole
Thanks Vadym - that made it clear to me!

Best regards
Ole

"Vadym Stetsyak" <va*****@ukr.netwrote in message
news:O3*************@TK2MSFTNGP04.phx.gbl...
Hello, Ole!

That will mean that number pending connections will be equal to 1.
That is if there are a lot hosts that want to connect connection queue's
size will be 1, thus
some hosts will be refused connection.
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com

Aug 22 '06 #5

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

Similar topics

8
by: simon place | last post by:
Spent some very frustrating hours recoding to find a way of closing a server socket, i'd not thought it would be any problem, however, after complete failure and as a last resort, i looked at the...
4
by: DreJoh | last post by:
I've read many articles on the subject and the majority of them give the same solution that's in article 821625 on the MSDN website. I'm using the following code and when a the client disconnects...
4
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed...
2
by: John J. Hughes II | last post by:
What is the maximum value for "backlog" when running on Windows 2003 server? It is my impression this value is based on the OS so Windows XP Pro has a maximum value of 10. Based on the document...
0
by: Macca | last post by:
Hi, I am writing an asychronous socket server to handle 20+ simulataneous connections. I have used the example in MSDN as a base. The code is shown at end of question. Each connection has a...
3
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the...
5
by: darthghandi | last post by:
I've created a class to listen to all interfaces and do a BeginAccept(). Once it gets a connection, it passes the connected socket off and stores it in a List. Next, it continues to listen for...
4
by: MattC | last post by:
I've written an HTTPHandler that implements IHttpAsyncHandler. This handler makes a call to a webservice that will send back a byte to be sent back to the webrowser as an image. I've set the...
4
by: O.B. | last post by:
I have a socket configured as TCP and running as a listener. When I close socket, it doesn't always free up the port immediately. Even when no connections have been made to it. So when I open...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.