Teen Programmers Unite  
 

 

Return to forum top

Lan games

Posted by MrSmiley [send private reply] at May 23, 2003, 08:22:48 AM

Does any one know how to make a program with lan connections???

Posted by CViper [send private reply] at May 23, 2003, 06:21:18 PM

Check network programming in general; most LAN networks use TCP/IP, i.e. the same protocol as with WAN (internet and stuff).

If you're working with windows, check the winsock documentation.

Posted by ItinitI [send private reply] at May 23, 2003, 10:03:01 PM

Maybe Socket Programming??

Posted by rafik_rezzik [send private reply] at May 25, 2003, 04:37:45 PM

You would have to do some socket programming. In Windowz (wich I loath) you can use Winsock. If you are using a Unix I recommend reading Beej's guide. Just google "Beej's"

Posted by Neumann [send private reply] at May 25, 2003, 05:00:03 PM

Beej guide also apply to Winsock if you can do without async sockets. Most people learning sockets can.

Posted by sphinX [send private reply] at May 25, 2003, 05:24:51 PM

If you're using Cygwin under Windows then you can use Unix sockets due to the nice POSIX emulation layer that Cygwin provides.

Posted by Neumann [send private reply] at May 25, 2003, 06:06:15 PM

Actually, I'm surprised that everyone seems to be ignoring that Winsock uses standard BSD functions + proprietary extensions.

In fact, except for the mandatory WSAStartup() call required in Windows. Programs built using standard Unix sockets _should_ compile in Windows.

Posted by MrSmiley [send private reply] at May 25, 2003, 10:16:21 PM

Does any one know how to do it in C++ if so could you send me the code at Raycar427@msn.com, and if it needs a certain type of header file could you send that also?... thnx, you can also put it on the forum, i bet many ppl would be happy about that. hmmm...god can i have another cheese sandwich?

Posted by ItinitI [send private reply] at May 25, 2003, 11:30:52 PM

lol... here's Beej's guide [if you dont feel like googling :P] http://www.ecst.csuchico.edu/~beej/guide/net/

Posted by Mike_L [send private reply] at May 28, 2003, 08:55:46 AM

MrSmiley, Have you considered using SDL? SDL is a nice library for making games and other kinds of programs. It has a very helpful module for network programming, SDL_net.

http://www.libsdl.org/projects/SDL_net/

As for making a LAN game, you need to decide if the game will only work on a LAN, or if it will work on the Internet too. For LAN-only games, you can use the UDP protocol to send packets to the LAN's broadcast address. This is the easiest method. For Internet games, your program must send packets to all of the players in the game. The type of game you are making will determine which method you should use. Network game design is a big topic. We can't say anything else until we have some details about your project.

Posted by Mike_L [send private reply] at May 28, 2003, 09:01:31 AM

Neumann wrote:
> Actually, I'm surprised that everyone seems to be
> ignoring that Winsock uses standard BSD functions +
> proprietary extensions.

I'm afraid it's not true. Although Winsock provides functions with similar names and behavior to the BSD sockets, they are not compatible. For example, Winsock does not let you read() on a socket; you must use recv() instead. Also, Winsock's flags have completely different names. Even though the two APIs are not compatible, it is usually not difficult to port a BSD sockets program to Winsock.

Posted by Neumann [send private reply] at May 28, 2003, 09:05:14 AM

Thank you for correcting Mike_L. I actually never did socket programming in *NIX so I didn't know the differences. I just 'guessed' they were very similar.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.