Hey all, im writing a small winsock application. Im trying to send a file line by line to a server, currently the code is supposed to do this:
Send the text "SND" to the server, when the server receives this it stores the rest of the incoming data into a file until the client sends the text "FIN"
on the client send im using this code:
And on the server side im using this:Code:Private Sub WSocksend_dataArrival(ByVal bytesTotal As Long) Dim indata As String Dim cline As String WSockSend.GetData indata indata = Replace(indata, vbLf, vbCrLf) TStatus.Text = TStatus.Text & indata If indata = "ACK" Then WSockSend.SendData ("SND") Open CFFile For Input As #1 While Not EOF(1) Line Input #1, cline WSockSend.SendData cline Wend WSockSend.SendData ("FIN") Else End If
Private Sub FXListen_dataArrival(Index As Integer, ByVal bytesTotal As Long)
Now the problem is that the server is receiving everything in one big chunk! which means its not writing it to the file because it never receives the text "SND" on its own, it receives SND and then the whole of the file and then FIN at the end which ive got it to display a text box for debugging purposes.Code:FXListen(NumSockets).GetData indata indata = Replace(indata, vbLf, vbCrLf) TConData.Text = TConData.Text & indata & vbCrLf If indata = "SND" Then Do Until indata = "FIN" Print #1, indata & vbCrLf TConData.Text = TConData.Text & indata & vbCrLf Loop Else End If Close #1 End Sub
Is there anyway i can get it to just send one line at a time?
Thanks!




Reply With Quote