473,573 Members | 3,030 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 12997
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
19845
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:...
0
2074
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...
1
1296
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...
4
2545
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
6307
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
1079
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...
2
2343
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...
2
1485
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 ??...
0
1232
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...
0
7783
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7701
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7794
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6424
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...
0
5293
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3734
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...
0
3735
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2222
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
0
1044
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...

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.