I do not know if this is easy or hard (I remember google'ing back in the day and didn't even find to much useful stuff in C++) but how would I got about sending a packet in visual basic (to a IP address?)
Last edited by Zeratulsdomain; Jun 1st, 2005 at 11:53 PM.
I have been reading with winsock and noticed a lot of the time you need to have a two way connection already established and you can only send strings of data...
What I essentially want to do is have a program that sends the data in hex. And the other computer does not have Winsock...
Basically, ill find out the exact packet that I need to send for "I am being attacked" or "My pc specs are....." , or "your latency is ***" (the ping is the last on my list). To what end? To make my life easier in my game while learning how these raw sockets work...
I have been reading with winsock and noticed a lot of the time you need to have a two way connection already established and you can only send strings of data...
True, a connection has to be established before you can send/receive anything.
False, you can send receive other data types. Look here.
What I essentially want to do is have a program that sends the data in hex. And the other computer does not have Winsock...
Use the list of data types in the above link to determine what you will need to use. In my case, all of my VB apps send data to servers written in ANSI C so I use UDTs that match the C programs' structs. Winsock doesn't do UDTs, so I move them to/from byte arrays before/after sending/receiving.
What exactly do you mean by "does not have Winsock"? The other computer will have to be on a LAN/WAN in order for you to connect to it. It will also need a server that your client can connect to.
What exactly do you mean by "does not have Winsock"?
I mean, I just want to send data to him, I do not want to have a connection with him (Not having to send everyone this program for them to get the packets.)
What you are looking for is UDP protocol, the less well known brethren to TCP in the TCP/IP suite. UDP is a connectionless unreliable protocol. What unreliable means is that packets are not guaranteed to be received, and the order of the packets in not certain. Therefore, if your data is large enough that it will span more than one packet, you will have to deal with packet ordering within your program. You would not need to do that with TCP. The plus side is that UDP is faster, and requires no connection. For this reason, UDP is the protocol of choice for multi-player games (unless something newer has come out).
Think of TCP as a phone call, where a connection must be made for information to flow. UDP is like a letter, where you address it and send it out, and it probably will be received, but normally you won't know. Like a letter, if it is critical, you will want a return receipt system, but you will have to make one yourself. I would keep re-sending critical messages periodically, until either a return receipt was received, or until enough tries have failed that you can be certain that there is nobody receiving the packets.
I understand the differences between TCP and UDP (read it in the winsock article and once took both high school Cisco courses (got a 94% second semester)). But my understanding was that winsock can use udp...
I understand the differences between TCP and UDP (read it in the winsock article and once took both high school Cisco courses (got a 94% second semester)). But my understanding was that winsock can use udp...
Hunh? Yes, winsock can use UDP.
I see that you want the other computer to not need winsock. Is that the problem?
The sender and receiver have to be able to speak the same language, which is what (along with conflict resolution) protocols are all about. Winsock is an encapsulation of the techniques for packaging and unpackaging the data in a packet within the context of one of the protocols. Without that, you are just reading bytes. A good book on TCP/IP will show you what a packet looks like (how many bytes are the header, how many bytes are the address, how many bytes are the message, etc.). With this, you should be able to write your own interpreter, once you can interface with the network card to get the actual bytes. Lot more work than winsock, though.
The sender and receiver have to be able to speak the same language
But the game I play uses UDP packets... If I sent the exact duplicate of a packet (that the game sent to say: Hello) wouldn’t the game and my program be speaking the <same language>? I might have to read up on this again, it’s been a while (not sure what to start reading though)...
I never realized how hard this was to do in vb...
(how many bytes are the header, how many bytes are the address, how many bytes are the message, etc.).
But I can get that information easily (commview).
Maybe I should get a hang of all this with commview (or a similar program) then once I get it all figured out and working perfectly I could look more into coding a program...
If you sent the same packet as the game sends, it should appear the same to the game.
To some extent, I would suggest that you dive in. There is an amount you can learn from a book or a tool, but there comes a point where you have to get your hands dirty, and that point generally arrives before you have full mastery of the concept at hand.
You never fully understand a problem until you have solved it once.
If you sent the same packet as the game sends, it should appear the same to the game.
Actually I recently learnt that the reason is was not accepting it was due to the SYN, each packet comp A sent to B would increase the SYN by 1. So sending a packet is a little more complex.
Originally Posted by Shaggy Hiker
To some extent, I would suggest that you dive in. There is an amount you can learn from a book or a tool, but there comes a point where you have to get your hands dirty, and that point generally arrives before you have full mastery of the concept at hand.
You never fully understand a problem until you have solved it once.
I probably google'ed for like 30-60 minuts trying to find all the information I could on UDP. Not much information on it (mosty on TCP for obviouls reasons.)
It has been a year or two since I have looked, but it seemed like every book on game programming had a section on UDP, largely because that is what is commonly used for multi-player games. Depending on your location, it might pay to stop by a Barnes and Noble for an hour or two.