Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations danielledunham on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error 40026 WINSOCK

Status
Not open for further replies.

Themuppeteer

Programmer
Joined
Apr 4, 2001
Messages
449
Location
BE
I've typed the msdn example about winsocks, it gives me
"Runtime error '40026':
Wrong protocol or connection state for the requested
transaction or request"

I followed exactely the msdn to create it.
Can anyone help me ?

Here's the code...
SERVER
-------
Private Sub Form_Load()
'Winsock1.Protocol = sckTCPProtocol
tcpServer.LocalPort = 1001
tcpServer.Listen
frmClient.Show
End Sub

Private Sub tcpServer_ConnectionRequest(ByVal requestID As Long)
If tcpServer.State <> sckClosed Then
tcpServer.Close
tcpServer.Accept requestID
End Sub

Private Sub tcpServer_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
tcpServer.GetData strData
txtOutput.Text = strData
End Sub

Private Sub txtSendData_Change()
tcpServer.SendData txtSendData.Text
End Sub

CLIENT
------
Private Sub cmdConnect_Click()
tcpClient.Connect
End Sub

Private Sub Form_Load()
tcpClient.RemoteHost = &quot;The muppet&quot;
tcpClient.RemotePort = 1001
End Sub

Private Sub tcpClient_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
tcpClient.GetData strData
txtOutput.Text strData
End Sub

Private Sub txtSend_Change()
tcpClient.SendData txtSend.Text
End Sub




 
I've tried it with port 80 and then it works... strange.
Are there perhaps some ports you can't use in VB ??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top