tcpclient.connect very slow 
Author Message
 tcpclient.connect very slow

Here is a sample of code someone on this group gave me.  It does work except
the connect takes 20-30 seconds to respond before the next line of code will
execute.

If you have any idea why please let me know.

Thanks

Option Strict On
Option Explicit On
'***************************************************************
'* 24July2002
'* Shawn Shelton
'* This will attemtp a socket connection to check for the existence
'* of a server
'***************************************************************
Imports System.IO
Imports System.Net.Sockets

Module CheckForServer
Public Function OpenSocket(ByVal server As String, ByVal Port As Short)
As Boolean
Dim tcpClient As New System.Net.Sockets.TcpClient()
Dim reader As StreamReader
Dim buffer As String
Try
tcpClient.Connect(server, Port)
reader = New StreamReader(tcpClient.GetStream())
buffer = reader.ReadLine()
reader.Close()
OpenSocket = True
Catch ex As Exception
OpenSocket = False
End Try
End Function
End Module



Mon, 31 Jan 2005 03:59:24 GMT  
 tcpclient.connect very slow

Quote:
> Here is a sample of code someone on this group gave me.  It does work
except
> the connect takes 20-30 seconds to respond before the next line of
code will
> execute.

If you use telnet to that server:port, will you experience this problem?

--
Peter Wu
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no
rights.



Sat, 05 Feb 2005 13:25:09 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Slow, slow, slow search on VB6, ADO and SS7

2. VB4 is slow..slow....slow

3. Insert into SQL Server slow, slow, slow...

4. mshflexgrid datasource slow connect

5. tcpClient and sockets question

6. TCPClient Read Timeout detection

7. TcpClient objects

8. tcpClient: How to get remote IP?

9. TCPClient connection timeout?

10. TcpListener&TcpClient

11. Problem using tcpClient in VB.Net

12. TcpClient forcibly closed

 

 
Powered by phpBB® Forum Software