Compiling a Server Program

Reply

Join Date: Oct 2008
Posts: 42
Reputation: JimD C++ Newb is an unknown quantity at this point 
Solved Threads: 0
JimD C++ Newb JimD C++ Newb is offline Offline
Light Poster

Compiling a Server Program

 
0
  #1
Apr 14th, 2009
Hello, all!

I'm trying to understand how a client/server would work, and I found a server example I could play with on the internet. However, I can't get it to compile due to a bunch of undefined variables (sendto, socket, etc).

Are there some options I should include in the command line when I compile?

Thank you

- Jim
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 12
Reputation: krellor is an unknown quantity at this point 
Solved Threads: 0
krellor krellor is offline Offline
Newbie Poster

Re: Compiling a Server Program

 
0
  #2
Apr 14th, 2009
Could you link to the example? First thing that springs to mind is that the example was made for a different platform (UNIX v WIndows) and the headers are not being found. But without more info I dunno.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 42
Reputation: JimD C++ Newb is an unknown quantity at this point 
Solved Threads: 0
JimD C++ Newb JimD C++ Newb is offline Offline
Light Poster

Re: Compiling a Server Program

 
0
  #3
Apr 14th, 2009
Sure!

http://beej.us/guide/bgnet/output/ht...l#simpleserver

It's the 'listener' example

Also was looking at the 'server' example

Thank you

- Jim
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 12
Reputation: krellor is an unknown quantity at this point 
Solved Threads: 0
krellor krellor is offline Offline
Newbie Poster

Re: Compiling a Server Program

 
0
  #4
Apr 14th, 2009
Ok, so it looks like that code is for UNIX. Are you running windows? If you are you can try this C socket tutorial:

http://www.shadowsprite.com/shadowsp...code&Itemid=56

and the full code at:

http://www.shadowsprite.com/shadowsp...=36:c&Itemid=1


I apologize if you are not using windows. If you are using *nix, what distro?
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 42
Reputation: JimD C++ Newb is an unknown quantity at this point 
Solved Threads: 0
JimD C++ Newb JimD C++ Newb is offline Offline
Light Poster

Re: Compiling a Server Program

 
0
  #5
Apr 14th, 2009
I am running it on my school's frodo if that helps
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,607
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Compiling a Server Program

 
0
  #6
Apr 14th, 2009
i dont think anyone knows what your schools frodo is.

simple answer: run sockets on Unix/Linux using teh <sockets.h> library.

run socket programs on windows using the <winsock.h> library.

the rest is just details.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 12
Reputation: krellor is an unknown quantity at this point 
Solved Threads: 0
krellor krellor is offline Offline
Newbie Poster

Re: Compiling a Server Program

 
0
  #7
Apr 14th, 2009
Frodo as in the commodore 64 emulator?
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 42
Reputation: JimD C++ Newb is an unknown quantity at this point 
Solved Threads: 0
JimD C++ Newb JimD C++ Newb is offline Offline
Light Poster

Re: Compiling a Server Program

 
0
  #8
Apr 14th, 2009
No not the Commodore 64 emulator - it is a Unix system that we can telnet into
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 12
Reputation: krellor is an unknown quantity at this point 
Solved Threads: 0
krellor krellor is offline Offline
Newbie Poster

Re: Compiling a Server Program

 
0
  #9
Apr 14th, 2009
To be honest, I've never heard of it. Obviously it is not finding the header files. You might need to ask your sysadmin what steps you need to take to compile C in your working directory, or to make the headers available. Barring that, just burn Ubuntu or Knoppix and use their Live CD mode to play around in a *nix environment. Although if all you are trying to do is figure out client/server socket communication, just look at the windows ready code in the links above and compile it on your windows machine (I assume Windows since you say you are telneting into a UNIX environment).
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,607
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Compiling a Server Program

 
0
  #10
Apr 14th, 2009
^ you havent heard of Unix? or his schools' particular implementation? most unix systems are named. it's just a geek thing. his school's is named Frodo. Mine was named Eos. ive seen others such as "Dante" or even more recently, "Quidditch". i figured that was what he was talking about, but it's not particularly useful to refer it to people who dont go to your school.


^^ anyhow, JimD, those variables you refer to are defined in the header files such as /sys/socket.h, /arpa/inet.h ... if your program cant find those #defines, then maybe those libraries are not being made available to you on your system, or they're in an unusual location.

IIRC, my undergrad program did not allow people to set up servers on the campus unix system.

so, if you're having trouble, i'm not surprised. i doubt you'd be able to set up a server/client even within your unix network, and i'm certain you won't be able to do it remotely.

try using it on your home computer instead.

you can run the server and client on the same machine, and use the localhost IP. But a more interesting example would be if you have two machines (say a laptop and a desktop) networked through a home router.
Last edited by jephthah; Apr 14th, 2009 at 7:32 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC