Networking

For issues with communication ports, protocols, etc.
Post Reply
Zamaster
Posts: 1025
Joined: Jun 20, 2005 21:40
Contact:

Networking

Post by Zamaster »

Uh... what do I do? Literaly, Im that confused. I want to be able to send data between two computers over the internet, not streaming but not too slow. I now absolutely nothing when it comes to this subject, except I think ive heard something about TCP/IP before. Ive also heard words like client and server and stuff. Wait, lemme rephrase my question, How do I send data between multiple computers? Like COMP-B sends the number 10 to COMP-A and COMP-A sends to COMP-C who sends back to COMP-B. Where do I start?
Ryan
Posts: 695
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Post by Ryan »

First, three resources:

http://tangentsoft.net/wskfaq/
http://beej.us/guide/bgnet/output/htmlsingle/bgnet.html
Download netgame_01.zip

The first two use C code, but the info is great and the examples are easily adaptable. The third is a not so polished demo release of a netgame library I've been working on.. probably the least helpful of these three but there for now. = P

Anyways, you'll have to understand sockets. If two computers are like two people using a phone to communicate, the socket is like the line connecting their phones. It connects user A to user B and allows data to be transmitted as long as the line is open and running well. In network programming, you need to be able to connect this "phone line" between computers. So you open a socket (i.e. pick up the phone), connect it to the other computer (i.e. dial the number), they accept the connection (i.e. pick up their ringing phone), and then transmit data (i.e.... talk ;). So, you have to create a program that does one or both of the following: opens a socket, sets it to either connect to a remote computer or accept/listen for a connection, transmits the data, and then closes down when it's all done.

Those tutorials above cover this all pretty well if I remember right (that's how I learned... that and a lot of winsock.hlp if you can find that on your computer). The thing is, you need to have a socket connection to be able to transmit data. So in your case, you would have to have sockets from each of those clients open to each of the other two. I prefer a client/server model (though it's not the only one) where you create a server program that just sits there listening for and accepting connections. Then it receives data from the clients and outputs the appropriate response to each of the clients connected.

Plenty of this is beyond you, I'm sure, and it's rather late, so I'm going to stop here before it gets too confusing. I'd say check out those tutorials (esp. the second one seems to be highly recommended) and ask any questions. ^_^
Ryan
Posts: 695
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Post by Ryan »

By the way, winsock is what you'll probably be using at least for starters. There are code examples for winsock packaged with FB, and the netgame library above uses winsock as well. The first tutorial is all about winsock, and while the code may be C, the commands and procedures are the same. Anyways, ask if you run into something you can't figure out!

You might also try searching the forums here for winsock or chat program, as I know several other people have written examples and mini-programs with it.
Post Reply