Web Development

General discussion


sendto using Visual Basic 6

By chenjoey ·
I'm trying to write a packet generator in Visual Basic 6.0. Specifically I need to be able to create a custom TCP,UDP and ICMP packet.

I'm using the following: Public Declare Function sendto Lib "ws2_32.dll" (ByVal s As Long, ByRef buf As Any, ByVal lngLen As Long, ByVal flags As Long, udtTo As sockaddr_in, ByVal tolen As Long) As Long

I've read that for 'buf as Any' that I'm supposed to send in an array of bytes. Can anyone verify this? To convert the string to a byte array I'm using the following:
arrBuffer() = StrConv(Data, vbFromUnicode)

If I'm trying to send a self generated packet, what should be sent in for 'Data'?
Currently I'm sending something like this:

The data is supposed to contain the ip header and tcp header, although this example just shows the ip header. Is this the correct way to use sendto?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums