Skip to content

akm0012/Socket_Programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview:

These two programs show how I used both TCP and UDP socket programming to allow two Clients to play the classic game of NIM with one another.  The Server is used to arrange a “rendezvous” between the two Clients, and then after the two Clients are paired, they only interact with one another.  For instructions on how to play NIM visit http://en.wikipedia.org/wiki/Nim. 

Compile Instructions:

The easiest way to compile all files is to run "compile_all.cmd" by typing: 
	./compile_all.cmd  

Note: if you do not have run permissions, you may have to type: 
	chmod 775 compile_all.cmd

If you want to compile the programs individually, you can do so by typing the following:

	cc -o Client.exe Client.c
	cc -o Server.exe Server.c

Run Instructions: 

To run the server type:

	./Server.exe [PORT NUMBER]
	
[PORT NUMBER]: The port on which the server is accepting requests.

To run a client type:

	./Client.exe  [SERVER NAME] [PORT NUMBER] [MY PORT]

[SERVER NAME]: The server hostname.
[PORT NUMBER]: The port where the server is running.
[MY PORT]: The TCP port where the client is willing to play NIM.

Example:
	./Server 10025
	./Client.exe 127.0.0.1 10025 10085 

Note: You will have to run 2 clients in order to play a game of NIM.  Otherwise, 1 client will just be waiting forever to be paired up with another client. 



About

Using socket programming to play the game Nim.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published