Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sendfile Via Winsock
#1
I've seen a ton of sample code, and snippets, but I'm really bad with networking (Even outside Winsock)

How would I send a file as a string (binary right?) then receive it on the client's end?
Reply
#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
#3
Thanks, but I know how to use it for string packet data, I'm unsure of how to write the data to a file in image format.
Reply
#4
i dont understand XD in that case i have no clue
Reply
#5
Just use Inet.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#6
I don't know how to use Inet for a PC, if they aren't set up as a web server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)