Number of downloads: 67Basicly ive been working on this for awhile, I got some sample code for a file transfer it was wrote in vb06 and im trying to convert it to vb.net. well it converts fine but i just cant figure this out. Ive added the file attachment.
Private Sub tcpServer_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles tcpServer.DataArrival ' Dim Command_Renamed As String Dim NewArrival As String Dim Data As String Static DataCnt As Integer tcpServer.GetData(NewArrival, VariantType.String) '← problem right here ' Extract the command from the Left ' of the comma (default divider) Command_Renamed = EvalData(NewArrival, 1) ' extract the data being sent from the ' right of the comma (default divider) Data = EvalData(NewArrival, 2) ' execute according to command sent Dim Fname As String Select Case Command_Renamed Case "OpenFile" ' open the file ' the file name only should've been sent Fname = My.Application.Info.DirectoryPath & "\" & Data FileOpen(1, Fname, OpenMode.Binary) ' file now opened to recieve input Status("File opened.... " & Data) Case "CloseFile" ' close the file ' all data has been sent, close the file FileClose(1) Status("File Transfer complete...") Pause(3000) Status("Listening... (Connected)") ' when sending a file.... it is best not to Name ' the Case instead use ELse for file transfer Case Else ' a 4169 byte string of incoming data ' write the incoming chunk of data to the ' opened file FilePut(1, NewArrival) ' update the view port with the new addition ' ** // ** ' ' IMPORTANT: comment out the code below when sending files ' larger than 500Kb. It makes the function CRAWL otherwise txtView.Text = txtView.Text & NewArrival ' comment the above line to increase speed ' count and report the incoming chunks DataCnt = DataCnt + 1 Status("Recieving Data... " & (MAX_CHUNK * DataCnt) & " bytes") End Select End Sub
EDIT: Title edited to be more descriptive