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

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.

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/shadowsprite/index.php?option=com_content&view=article&id=51:simple-win-sockets-in-c&catid=37:code&Itemid=56

and the full code at:

http://www.shadowsprite.com/shadowsprite/index.php?option=com_content&view=article&id=52:winsockets-example&catid=36:c&Itemid=1


I apologize if you are not using windows. If you are using *nix, what distro?

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.

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).

^ you havent heard of Unix? or his schools' particular implementation? :P 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.

This article has been dead for over six months. Start a new discussion instead.