commando OG data med socket?
hej eksperter.jeg er ved at lave et "remote control" program,
jeg kan godt få forbindelse mellem 2 pc'er og sende tekststrenge mellem dem, men jeg vil gerne kunne sende "kommandoer" dvs sende commandoen og eventuelle parametre, er der nogen der kan hjælpe?
jeg bruger følgene kode:
"styre program"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Winsock1.Connect()
Winsock1.Send("LOL!")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Winsock1.Listen()
End Sub
Private Sub Winsock1_Connected(ByVal sender As Winsock_Control.Winsock) Handles Winsock1.Connected
MsgBox("OMG CONNECTION")
End Sub
Private Sub Winsock1_DataArrival(ByVal sender As Winsock_Control.Winsock, ByVal BytesTotal As Integer) Handles Winsock1.DataArrival
Dim s As String
Winsock1.GetData(s)
MsgBox(s)
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Winsock1.Send(TextBox1.Text)
End Sub
End Class
"modtagende program"
Private Sub winsock1_ConnectionRequest(ByVal sender As Winsock_Control.Winsock, ByVal requestID As System.Net.Sockets.Socket) Handles winsock1.ConnectionRequest
winsock1.Accept(requestID)
commandsock.Accept(requestID)
End Sub
Private Sub winsock1_Connected(ByVal sender As Winsock_Control.Winsock) Handles commandsock.Connected
MsgBox("OMG IM CONNECTED TOO!")
End Sub
Private Sub commandsock_DataArrival(ByVal sender As Winsock_Control.Winsock, ByVal BytesTotal As Integer) Handles commandsock.DataArrival
Dim s As String
commandsock.GetData(s)
execute(s)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
commandsock.Send("winmx32test")
End Sub
Public Sub execute(ByVal command)
Select Case command
Case "msg"
MsgBox("lolololololol")
Case "kagemand"
MsgBox("kagemand er godt")
Case "jonas"
MsgBox("LUGTER!")
Case Else
MsgBox("bahh")
End Select
End Sub
End Class
jeg kan sende kommando er som msg, kagemand og jonas. men hvordan ken jeg sende F.eks kommandoen "jonas" med parametret "random crap"