Posted on 1999-07-30
Medium Priority
Last Modified: 2013-12-25
How do i get Winsock to Accecpt a tcp connection request? Here is what i get so far

Private Sub Form_Load()
Winsock1.LocalPort = 1001
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If tcpServer.State <> sckClosed Then _
' Accept the request with the requestID
' parameter.
tcpServer.Accept requestID
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
aldjf = aldjf + 1
If aldjf = 1 Then
tcpServer.GetData strData1
Label1.Caption = strData1
End If
If aldjf = 2 Then
tcpServer.GetData strData2
Label2.Caption = strData2
End If
If aldjf = 3 Then
tcpServer.GetData strData3
Label3.Caption = strData3
End If
If aldjf = 4 Then
tcpServer.GetData strData4
Label4.Caption = strData4
End If
If aldjf = 5 Then
tcpServer.GetData strData5
Label5.Caption = strData5
End If
If aldjf = 6 Then
tcpServer.GetData strData6
Label6.Caption = strData6
End If
End Sub

i have that for the server

Private Sub Command1_Click()

Timer1.Enabled = True
Screen.MousePointer = 11
End Sub

Private Sub Command4_Click()
Winsock1.RemoteHost = iptocall.Text
Winsock1.RemotePort = 1001
End Sub

ctttps = ctttps + 1
If ctttps = 1 Then
Winsock1.SendData Text1.Text
End If
If ctttps = 2 Then
Winsock1.SendData Text2.Text
End If
If ctttps = 3 Then
Winsock1.SendData Text3.Text
End If
If ctttps = 4 Then
Winsock1.SendData Text4.Text
End If
If ctttps = 5 Then
Winsock1.SendData Text5.Text
End If
If ctttps > 5 Then
Timer1.Enabled = False
Screen.MousePointer = 0
End If
End Sub

can anyone help me.  I would appreciate it. Thanks in advance.

P.S.    I get a runtime error 40006 saying "Wrong protocol or connection state for the requested transaction or request."
Question by:master01
1 Comment

Accepted Solution

setiawan earned 80 total points
ID: 1495729
Before listen, assign winsock1.protocol = sckTCPProtocol


Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question