|
-
Oct 13th, 2006, 11:35 AM
#1
Thread Starter
Junior Member
-
Oct 13th, 2006, 11:26 PM
#2
Lively Member
Re: Client x Server Communication { Easy Question }
Client identifyer is winsock index, working with winsock arrays is easy, in any winsock sub there will be argument "Index As Integer", So when you need to send data to specified client you use Winsock1(Index).SendData "DataHere".
To identicate who sent the last data you can use a variable (Dim strLastWhoSent as String) and update it with the clients IP address when it requests a file from server.
For example:
VB Code:
Option Explicit
Dim strLastWhoSent as String
Private Sub Winsock1_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim sData As String
Winsock1(Index).GetData sData
'need to parse the request here...
'when its parsed you can select case or just use "IF .. " function to check what data was sent, and reply
If instr(sData,"GET ..... /yourfile.exe for example")<>0 then
'start to send the file..
'for now this is the last client who sent the file request, so update the strLastWhoSent
strLastWhoSent=Winsock1(index).RemoteHostIP 'the clients ip address
'You send to client that request is accepted for example..
Winsock1(index).SendData "bla bla bla accepted!"
end if
End Sub
Well hope this helps for you, if that is what you ment..
/Jean
Edit: forgot the vbcode brackets..
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
|