|
-
Jun 26th, 2000, 07:03 PM
#1
Thread Starter
Member
i want in to make a program, which accepts a command via sockets, and act upon each command differently, i.e: start recieving a file, store the next 10 strings in a record, etc.
what should i write in Winsck_DataArrival ?
and what next ? how do i make it know when to start recieving a file and when to start reciving the strings, and also other 'commands' ?
-
Jun 26th, 2000, 09:42 PM
#2
You should make a protocol for the information you send.
For example you send
MSGB, Then the receiving program knows it needs to display a messagebox.
SRCF, Instruction for receiving a file etc.
Example:
Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Winsock1.GetData sData
Select Case UCase$(sData)
Case "MSGB"
MsgBox "Program recieved command to display a messagebox"
Case "SRCF"
'Start file recieve function
'End Case
End Select
End Sub
As for sending files/strings, what I find useful is to open an additional winsock, and send the file to that one, and then close the winsock when the file is done. This is almost necessary for binary files because you can't send a char for termination(because that one might be used in the file).
Hope it helps,
-
Jun 26th, 2000, 11:55 PM
#3
Thread Starter
Member
gettting the file.
but how do i recieve the file itself ?
when i'll do winsock.getdata in another function, won't it run the winsock_dataaraival again ?
-
Jun 27th, 2000, 01:15 AM
#4
Add a second winsock, winsock2 for example, and use that to send the data to, then use the getdata method on winsock2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|