PDA

Click to See Complete Forum and Search --> : Dynamic Packet Construction


lspnet
Jun 5th, 2006, 06:08 AM
For you networking/coding gurus out there:

I'm looking to construct my own packets to use for a game chat network.

So far I've been able to sniff, interpret, and use incoming packets, but I'm a little stumped on how to construct my own. This is all done using Winpcap and the fantastic winpcap wrapper for VB (vbpcap).

Vbpcap has a vpSendPacket function that allows you to send raw packets as a byte array. I want to be able to generate and send dynamic packets to the chat server, so the user can type text and chat externally using my program.

Now, I know how to fill the byte array with most of the important TCP/IP header information, but there are a few things I'm not entirely sure about - how would I determine and calculate the TCP and IP header checksums? And what do I fill in as the Sequence and Ack numbers? Does it even matter or could I just be random?

Thanks for any help you guys can offer!

davidbishton
Jun 7th, 2006, 04:04 AM
I think it would be easier to use Winsock unless you have a need to be creating TCP packet headers specifically.

The seq and ack values cannot be random. The seq value is used to determine the order of the packets incase they arrive in a different sequence. Your program must be able to handle this factor when receiving packets if you choose to create your own packets.