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?)
Printable View
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?)
Even better than that. This will send info, and return info.
You could also look here http://www.vbforums.com/showthread.php?t=340097
tnx for the reply :)
I had completely forgotten about this tread :P
BUMP...
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...
True, a connection has to be established before you can send/receive anything.Quote:
Originally Posted by Zeratulsdomain
False, you can send receive other data types. Look here.
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.Quote:
What I essentially want to do is have a program that sends the data in hex. And the other computer does not have Winsock...
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.
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.)Quote:
What exactly do you mean by "does not have Winsock"?
Aside from putting the data on a floppy or cd and mailing it to him, I don't think you have many other options.
But there are programs that can receive/send packets, you can write your own and send them... Are you saying this cant be done in vb?
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...
Hunh? Yes, winsock can use UDP.Quote:
Originally Posted by Zeratulsdomain
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.
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)...Quote:
The sender and receiver have to be able to speak the same language
I never realized how hard this was to do in vb...
But I can get that information easily (commview).Quote:
(how many bytes are the header, how many bytes are the address, how many bytes are the message, etc.).
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.
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.Quote:
Originally Posted by Shaggy Hiker
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.)Quote:
Originally Posted by Shaggy Hiker
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.