Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

WinSock

Posted on 1999-07-30
1
Medium Priority
?
436 Views
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
Winsock1.Listen
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If tcpServer.State <> sckClosed Then _
tcpServer.Close
' 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
Winsock1.Close
End Sub

i have that for the server

Private Sub Command1_Click()

Winsock1.Connect
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
sgbttu.Show
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."
0
Comment
Question by:master01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

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

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

705 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