Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sendfile Via Winsock
#2
now i cant get it to work all of the time but i now most of the syntax for it

say you made your server stuff and made your winsock and named it SockMain then you would prolly want to prep your data if your are doing packets (like the way Mirage does) if not then you can just skip this step
Code:
Dim Packet as string
Dim SentData as string

SentData = this is where you could either say it would come directly from a text box or label or you could have it as a variable for the sub this is in
Packet = "Whateveryourpacketnameshouldbe" & SEP_CHAR & SentData & SEP_CHAR & END_CHAR

SockMain(Index).SendData Packet                    'now im not sure exaclty about the index but i think thats how you do it

now youll want to go to your client and make another winsock and well call it SockMain too
this would go with the rest of the coding for the form that your winsock is on
Code:
Private Sub sockMain_DataArrival(ByVal bytesTotal As Long)
sockMain.GetData strData, vbString
Call HandleData(bytesTotal)
End Sub

now i usually put this in modClientTCP but you dont have to
Code:
Sub HandleData(ByVal Data As String)
Dim Msg As String
Dim Parse() As String

If Parse(0) = "Whateveryourpacketnameshouldbe" Then
    Msg = Parse(1)
    Call DoWhatEverWithMsgData(Msg)
End If
End Sub

and here are some tuts on another site that i find useful
a simple client server
http://www.vb6.us/tutorials/client-serve...l-tutorial

a multiple client server
http://www.vb6.us/tutorials/multiple-cli...ck-control

hope this helps
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)