473,624 Members | 2,119 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Net.Sock ets.Socket threw an exception

Hi,
My window application written in C# is throwing following exception
while connecting to one FTP location

The type initializer for System.Net.Sock ets.Socket threw an exception

This exe is working fine on staging environment, (Window 2003) but
after migrating to production environment (Windows 2000), throwing this
exception at

_clientSocket = new
Socket(AddressF amily.InterNetw ork,SocketType. Stream, ProtocolType.Tc p);

- Only three Network cards are installed on production server
- while checking TCP/IP port status , there were few connections at
TIME_WAIT mode. but this might not be the cause for insufficient buffer
space.
- Recenetly we have installed Microsoft.Net\F ramework\v1.1.4 322

If somehow this is related to buffer space/long que, then how to clear
this and manage for future.

Not getting any idea from where to start. Any idea/suggestion would be
of great help.

Thanks

Apr 3 '06 #1
6 13005
Aero <at**********@g mail.com> wrote:
My window application written in C# is throwing following exception
while connecting to one FTP location

The type initializer for System.Net.Sock ets.Socket threw an exception


Have you looked at the inner exception of that exception? It should
give more details about what went wrong.

It's very worrying if the type initializer threw an exception though -
that suggests that something is pretty wrong on the machine. (In
particular, it's unlikely to be anything to do with your code.)

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 3 '06 #2
Following is the code snippet which is causing the problem.
public void Login()
{
try
{
_clientSocket = new
Socket(AddressF amily.InterNetw ork,SocketType. Stream, ProtocolType.Tc p);
-----Error Point
}
catch(Exception Ex)
{
throw new IOException("Me ssage: " + Ex.Message+ "Source:" + Ex.Source+
"Inner Exception" + Ex.InnerExcepti on);
}
IPEndPoint remoteEndPoint = new
IPEndPoint(Dns. Resolve(_remote Host).AddressLi st[0], _remotePort);

try
{
_clientSocket.C onnect(remoteEn dPoint);
}
catch(Exception )
{
throw new IOException("Co uldn't connect to remote server");
}

Apr 3 '06 #3
Aero <at**********@g mail.com> wrote:
Following is the code snippet which is causing the problem.


Rather than a snippet, could you post a short but *complete* program
which demonstrates the problem?

Also, what is the inner exception in this case, if any?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 3 '06 #4
Actually Code is too big but i am getting the error at
Socket(AddressF amily.InterNetw ork,SocketType. Stream, ProtocolType.Tc p);
Error Message: The type initializer for "Syetem.Net.Soc kets.Socket"
threw an exception
Error Source: System.Net.Sock ets.SocketExcep tion
Inner Exception An operation on a socket sould not be
performed because the system lacked sufficient buffer space or because
a queue was full
at System.Net.Sock ets.Socket.Init ializeSockets()
at System.Net.Sock ets.Socket..cct or()

Please refer the following Microsoft article
FIX: Socket initialization does not succeed if your computer has more
than 50 network bound protocols
http://support.microsoft.com/?id=826757

Now we are planning to upgrade to Microsoft.Net Framework 2.0 on
production environment and lets see if it works or not.

Please suggest what can we do resolve this ASAP, even we are not sure
that will that work or not....just taking a chance.

Apr 4 '06 #5
Aero <at**********@g mail.com> wrote:
Actually Code is too big but i am getting the error at
Socket(AddressF amily.InterNetw ork,SocketType. Stream, ProtocolType.Tc p);
The existing code may be too big, but have you tried creating a sample
program just for the sake of pinning down the error?
Error Message: The type initializer for "Syetem.Net.Soc kets.Socket"
threw an exception
Error Source: System.Net.Sock ets.SocketExcep tion
Inner Exception An operation on a socket sould not be
performed because the system lacked sufficient buffer space or because
a queue was full
at System.Net.Sock ets.Socket.Init ializeSockets()
at System.Net.Sock ets.Socket..cct or()

Please refer the following Microsoft article
FIX: Socket initialization does not succeed if your computer has more
than 50 network bound protocols
http://support.microsoft.com/?id=826757

Now we are planning to upgrade to Microsoft.Net Framework 2.0 on
production environment and lets see if it works or not.

Please suggest what can we do resolve this ASAP, even we are not sure
that will that work or not....just taking a chance.


Well, have you read the article it referenced?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 4 '06 #6
Hi,
I am not able to simulate this problem in any of our environments. This
is occuring only on production server.
I tried a sample code there and again it gave the same error.
While investigating we found that production server has .Net framework
1.1.4322 installed without service pack 1.
Now we are assuming that this might be the problem and today we are
going to upgrade this to .Net Framework 2.0.50215
Lets see what happens. If it works fine then its OK otherwise i'll have
think in different direction.
Thanks for your valuable inputs.

Apr 6 '06 #7

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

Similar topics

3
19856
by: David Lozzi | last post by:
Hello, I'm receving the following on my webserver (Windows 2003 Server SP1) Event ID: 5 Source: Active Server Pages Error: File /KQShopping/ordercomplete4.asp Script Engine Exception. A ScriptEngine threw exception 'C0000005' in 'IActiveScriptParse::ParseScriptText()' from 'CActiveScriptEngine::AddScriptlet()'.. Event ID: 5 Source: Active Server Pages
0
2077
by: Jack | last post by:
I am trying to develop a simple telnet client in MS.NET I have a small wrapper around the System.Net.Sockets.Socket class which takes care of sending and receiving data and handing it off to a protocol handler. What I am finding is that if I set my receive buffer size to 1 byte this code will 'lose' characters, yet when I set the buffer to more than 1 byte all works fine.
1
1297
by: Tony Caduto | last post by:
Hi, I was trying to create a new class derived from System.Net.Sockets.Socket and it seemed to be working until I tried to use the accept method. The accept method returns a Socket object and for some reason you can't typecast it as the derived class. Everything else worked fine, I was able to add new methods etc etc Is there a way around this? Thanks,
4
2546
by: Claire | last post by:
I need UDP server and client components. Udpclient control is a no-no, it doesnt do what I need and its buggy. I'm looking for some sample code for setting up the system.net.socket as a simple udp client/server as previously I only ever used components to do this and never from microsoft windows api calls. can anyone help please thanks
4
6313
by: BadOmen | last post by:
Hi, What is the different between 'System.Net.Sockets.Socket' and 'System.Net.Sockets.TcpClient'? When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket?? Yours, Jonas
0
1081
by: Sherry | last post by:
We are using the sample code "AsynchronousClient" from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconnon-blockingclientsocketexample.asp. It works for the wired (ethernet) connection. While the laptop is in wireless environment, the laptop get exception: "System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it at...
2
2347
by: Stressed Out Developer | last post by:
We have an application that has a 200 count loop that does the following: ' Each time thru the loop we pass the next IP Address is a range (aka 192.168.4.50 thru 192.168.4.254) Try If mUIO_Threads(i) Is Nothing Then mUIO_Threads(i) = New System.Threading.Thread(AddressOf mUIO_DAQ(i).InitDAQ) mUIO_Threads(i).Name = mUIO_DAQ(i).UIO_IPAddr mUIO_Threads(i).IsBackground = False
2
1490
by: Frank Uray | last post by:
Hi all I am using System.Net.Sockets.Socket to connect to my Mailserver (http://www.codeproject.com/csharp/despop3client.asp). It all works fine exept one thing: I do not know how I can find out if the mail is already read or unread ... I also need to set this state to read, after I read it ... Does anybody knows something about this ?? Would be happy for any comments!
0
1238
by: =?Utf-8?B?TWFydGluVGVlZnk=?= | last post by:
Hi, I've read a lot about the use of system sockets in Vb.net instead of winsock fine but how do i get a vb.net service running on a 2003 server to send a message to a desktop vb6 exe that can only use winsock? So the service needs to send a message to the PC via some port say 8000. The service knows the IP address of the PC also. The system socket code sends the message and the VB6 exe has connected to the server on port 8000 but...
0
8677
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.