raj Newbie
Joined: 27 Apr 2005 Posts: 1
|
Posted: Apr 27th, 2005 07:33 AM Post subject: UDP (Packets send) |
|
|
I am making an application in which I am sending parameters as Packetsize Numberofpackets..Packetsize mean number of bytes in one packet...The code is as follows..
Private Sub send_Click()
Dim count As Variant
On Error Resume Next
If Socket.State <> 1 Then
Socket.LocalPort = 0
End If
numberofpackets = 0
count = 0
Socket.RemoteHost = sendaddr.Text
Socket.RemotePort = sendport.Text
Do While Not numberofpackets = pcktnumber.Text
count = count + 1
If count = pcktsize.Text Then
numberofpackets = numberofpackets + 1
count = 0
Socket.SendData (numberofpackets)
timer1.interval = delay.text (The delay time will be according to user put in textbox, if he put 1000 than it will be equal to 1 second delay)
(Its delay between two packets, After senidng one data it should send other after this much delay)
End If
Loop
recep.Text = recep.Text & " Server " & " " & " Packet Size " & " " & " Packet Send " & " " & " Packet Time" & vbCrLf & Socket.LocalIP & " " & pcktsize.Text & " " & numberofpackets & vbCrLf & vbCrLf
'Text1.Text = ""
'Text2.Text = ""
End Sub
Private Sub Socket_DataArrival(ByVal bytesTotal As Long)
Dim packetsreceived As Variant
Dim Bytesreceived As Variant
Socket.GetData packetsreceived, vbInteger
recep.Text = ""
recep.Text = recep.Text & " IP Address " & " " & " Packet Received " & " " & " Bytes Received " & vbCrLf & Socket.LocalIP & " " & packetsreceived & " " & Bytesreceived & vbCrLf & vbCrLf
sendaddr.Text = Socket.RemoteHostIP
sendport.Text = Socket.RemotePort
Beep
End Sub
Private Sub Socket_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "Erreur avec le socket! & vbcrlf # " & Number & vbCrLf & Description
Socket.Close
End Sub
Private Sub Timer1_Timer()
End Sub
Problem is that when I am sending number of packets it stays in loop and than send total number of bytes which is not correct anyone knows how to send data as bytes per byte.... |
|