Ok im trying to get this winsoc code to work but it not working!! i converted the code from vb6 to .net and it dont work any help ?
vb6
VB Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Client WS.Close WS.RemoteHost = txtIP.Text WS.RemotePort = txtPort.Text WS.Connect Do Until WS.State <> sckConnecting DoEvents: DoEvents: DoEvents: DoEvents Loop If WS.State = sckConnected Then MsgBox "Connected to " & txtIP.Text & " on port " & txtPort.Text & "!" Else MsgBox "Could not establish a connection. Sorry." End If end sub Private Sub cmdSend_Click() WS.SendData txtSend.Text End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''server Private Sub cmdBreak_Click() WS.Close End Sub Sub Log(Text As String) txtReceived.Text = txtReceived.Text & vbNewLine & Text txtReceived.SelStart = Len(txtReceived.Text) End Sub Private Sub cmdListen_Click() WS.LocalPort = txtPort.Text WS.Listen Log "[Listening on port " & txtPort.Text & "]" End Sub Private Sub WS_Close() Log "[Closed connection]" End Sub Private Sub WS_ConnectionRequest(ByVal requestID As Long) WS.Close WS.Accept requestID Log "[Connecting]" Do Until WS.State <> sckConnecting DoEvents: DoEvents: DoEvents: DoEvents: Loop Log "[Connected]" End Sub Private Sub WS_DataArrival(ByVal bytesTotal As Long) Dim Text As String WS.GetData Text Log "[Incoming Transmission]" & vbNewLine & Text End Sub Private Sub WS_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) Log "[Error: " & Number & " - " & Description & "]" End Sub




Reply With Quote