Home > Software engineering >  When using a SOCKET on the client side a REQUESTID CONNCET request is on the server side a SOCKET co
When using a SOCKET on the client side a REQUESTID CONNCET request is on the server side a SOCKET co

Time:09-22

A, the following code
Private Sub tcpServer_ConnectionRequest (ByVal requestID As Long)
On Error GoTo Errc

ServerSock1 (0). The Accept requestID
ServerSock1 (1). The Accept requestID

The Exit Sub
Errc:
MsgBox Err. The Description & amp; "Id:" & amp; Err. Number & amp; SOURCE: "" & amp; Err. Source
End Sub

Why a client CONNECT requests are ServerSock1 (0) after receiving (Accept), ServerSock1 (1) the Accept can also perform well?


After more than two, code execution on the server sends the message
Private Sub Command1_Click ()
ServerSock1 (0). SendData publishes the event "message from (0)"
End Sub

Private Sub Command2_Click ()
ServerSock1 (1). SendData publishes the event "message from (1)"
End Sub

The client receives the code
Private Sub CLientSock_DataArrival (ByVal bytesTotal As Long)

Dim S As String
CLientSock. GetData S

End Sub

After Command1_ Click execute CLientSock _DataArrival did not receive the message
Command2_ Click execute CLientSock_DataArrival after receiving the message

Why ServerSock1 (0), the client is not received?

CodePudding user response:

Is covered, the real work of only Accept after ServerSock1 (1),
From the function, twice the Accept belong to the error code,

CodePudding user response:

reference 1st floor Tiger_Zhao response:
is covered, really take effect only after the Accept the ServerSock1 (1),
From the function, the Accept twice belong to the error code,


Thank you very much, a little don't understand.

1, what you said two Accept belong to the error code, refers to the second Accept belong to the error code, that is to say,
ServerSock1 (0). The Accept requestID
ServerSock1 (1). The Accept requestID
These two sentences are wrong code, or
Only ServerSock1 (1). The Accept requestID error code is

2, since this is the error code, why still can normal execution,

CodePudding user response:

Paid for commercial projects with more than ten years called VB6 WinSock control example, [email protected]

CodePudding user response:

Coding idea "wrong" - coding is not normal,
Won't write two Accept normal code,

CodePudding user response:

The
reference 3 floor zhao4zhong1 response:
paid for commercial projects with more than ten years called VB6 WinSock control example, [email protected]


Thank you very much, your commercial source, how many money ah, is there a VB6 version of WeChat or pay treasure payment code, this need, can contact me directly please: 00 dress nine and and.
  • Related