473,769 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Socket connection delay in asp.net

I'm trying to use a socket connection from within an asp.net
application.
It works, but somehow opening the socket seems to be extremely slow.
It finally connects and you can transfer information, but it hangs for
at least 5 seconds before the connection completes. Interestingly, a
second connection to the same port in a very short time interval (<1s)
returns instantly, but if you wait for a couple of seconds a new
connection again takes very long. The same code in a standalone .net
application does not show this problem, so it must be something with
asp.net.

This is a piece of code in C# that shows this behavour in an asp.net
application (supposed something is listening on the local computer at
port 7000)

Socket s = new Socket(AddressF amily.InterNetw ork, SocketType.Stre am,
ProtocolType.Tc p);
IPHostEntry ipHostInfo = Dns.Resolve("lo calhost");
IPAddress ipAddress = ipHostInfo.Addr essList[0];
IPEndPoint ipe = new IPEndPoint(ipAd dress,7000);
s.Connect(ipe);

Any help appreciated!

Paul
Nov 18 '05 #1
0 1311

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

Similar topics

3
9114
by: Daniel | last post by:
TcpClient close() method socket leak when i use TcpClient to open a connection, send data and close the TcpClient with myTcpClientInstance.Close(); it takes 60 seconds for the actual socket on the client machine to close per my network app the computer fills up w/ thousands of these :0 TCP foobox:8888 localhost:2188 TIME_WAIT :0 TCP foobox:8888 localhost:2189 TIME_WAIT :0 TCP foobox:8888 localhost:2190 TIME_WAIT
1
2906
by: Amadej | last post by:
Hello everyone, I'm having some odd problems with a little program I wrote for sending/receiving bytes across the network. I am using synchronous sockets, and it seems that when I send byte after byte too fast, the packet gets lots somewhere (as odd as that sounds). Here's the sending code:
0
1414
by: Tom Stepka | last post by:
Problem: We are experiencing an excessive (i.e. 16 - 20 seconds) delay when attempting to establish socket connection over the network, using the TcpLister.AcceptSocket() and TcpClient.Connect(ipAddress, Port) calls. It seems that the delay is between client.Connect() and listener.Accept(). We never have a delay when we use a telnet client to connect to the server. And we do not have a delay on all networks, just on some. The code we...
0
1092
by: Crirus | last post by:
I have a Socket server. Any value I give to the listener.Listen(1) socket, seems that it accept any connection request... why's that? I set a sleep on send thread in order to delay the response and I made another few requests from differend browsers...all requests was accepted and then the threads resumed, browser received data I have the below function that start the server listening: Private Sub StartListening()
2
4157
by: Nuno Magalhaes | last post by:
I've got a simple problem I guess. How do I know when a connection is terminated without losing any data? I do something like the code below, but sometimes between socket.Receive and socket.Send I get the last chunk of data and am not able to retrieve it anymore cause the socket will be dead. Loop: { socket.Receive <----------- data arrives
1
2731
by: CKane | last post by:
i am trying to build a "missed message" queue on a C# TCP server. many of the devices connecting are mobile and may drop out in bad signal areas. i want to store any messages missed for when they reconnect. so far....it takes activity on the client end to initialize the close. isnt there a check when the server sends a socket.send to a client that has lost connection? it takes a few minutes for the exception to get hit, and i am losing...
0
4753
by: phplasma | last post by:
Hey, I am currently attempting to implement a multi-threaded C# socket, using SSL (.pem file/certification/private key combo) server using Visual Studio C# Express. I have successfully made the client application establish a connection, and send data, which appears in plain, de-crypted text on the server - this works.
6
9134
by: Giulio Petrucci | last post by:
Hi there, I need to implement a sort of RTP/RTSP. Nothing impossible, just a "minimal" implementation Anyway I need to know something more about how could I create real-time connection using the .NET socket class. Is it enough to write/read data in synchronous way? If not, could you link me to some resources in the net? Thanks in advance, Giulio - Italia
3
4108
by: A. W. Dunstan | last post by:
I have an application that wants to open a Socket, write data and close the socket. A persistent connection would be nice, but it's intended to operate in an environment where the network connection probably isn't reliable. So I do this: // open socket m_networkSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
0
9422
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10206
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
10035
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8863
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...
0
5293
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
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
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
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
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.