Re: Remote Message Box Popup
Heres the data arrival sub on server:
VB Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1(Index).GetData strData 'get the data
If Left(strData, 4) = "MSG " Then 'if the first part of the data says MSG
MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master" 'Show msgbox for example Chris: HEY
End If
End Sub
And in the client...
VB Code:
Private Sub cmdSend_Click()
Dim Data as String
Data = "MSG " & txtNick.Text & ": " & txtMessage.Text
Winsock.SendData Data
End Sub
Re: Remote Message Box Popup
but on server its a Select Case because it has multiple commands
for example on sever I have
VB Code:
Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
Dim incommingData As String
Winsock.GetData incommingData
Select Case incommingData
Case "closeserver"
End
Exit Sub
Case "strData"
Dim strData As String
Winsock.GetData strData
If Left(strData, 4) = "MSG" Then
MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master"End If
Exit Sub
Case "closeserver2"
End
Exit Sub
End Select
End Sub
and on Client I have
VB Code:
Private Sub cmdSend_Click()
Dim strData As String
strData = "MSG" & txtNick.Text & ": " & txtMessage.Text
Winsock.SendData strData
End Sub
should that work im useing Select Case's so... can you help? :)
Re: Remote Message Box Popup
have this as your select statement...
VB Code:
Select Case incommingData
Case "closeserver"
winsock.Close
Unload Me
Case Left(strData, 4) = "MSG "
MsgBox Split(strData, ":")(0) & ": " & Split(strData, ":")(1), vbInformation, "Message From Master"
End Select
Re: Remote Message Box Popup
Re: Remote Message Box Popup
Quote:
Originally Posted by GoldenZero
Vaiable not defined?
What variable?
Re: Remote Message Box Popup
you need to replace strData with incommingData
Re: Remote Message Box Popup
actually that select statement wont work, select only works if you know exactly which part of the data you want to check, if you want to check the first part and all of it, you need an if like in my first post
Re: Remote Message Box Popup
but what you have in your first post doesn't work
Re: Remote Message Box Popup
heres what I got
Client
VB Code:
Private Sub cmdSend_Click()
Dim Data10 As String
Data10 = "MSG" & txtNick.Text & ": " & txtMessage.Text
Winsock.SendData Data10
End Sub
Server
VB Code:
Private Sub winsock_DataArrival(ByVal bytesTotal As Long)
Dim incommingData As String
Winsock.GetData incommingData
If Left(incommingData, 4) = "MSG" Then
MsgBox Split(incommingData, ":")(0) & ": " & Split(incommingData, ":")(1), vbInformation, "Message From Master"
End If
Select Case incommingData
Case "closeserver"
End
End Select
It looks ok to me but something wrong.. any ideas?
Re: Remote Message Box Popup
Yes there is a problem with that....if someone posts code...dont change it or it will die, so why have you removed the space after "MSG " ??? read the statement left(..., 4) so theres for characters....."MSG " is 4, you changed it to "MSG" which is three, thats whats wrong
you also changed it in the client part too... "MSG " is what i said, not "MSG" if you want "MSG" then change the number to 3
Re: Remote Message Box Popup
ohhhhhh I see thanks :D
ohya I thought you put space by mistake but i see now :)