| | |
Compiling a Server Program
![]() |
•
•
Join Date: Oct 2008
Posts: 40
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Oct 2008
Posts: 40
Reputation:
Solved Threads: 0
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
http://beej.us/guide/bgnet/output/ht...l#simpleserver
It's the 'listener' example
Also was looking at the 'server' example
Thank you
- Jim
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 0
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?
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?
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 0
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?
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.
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.
![]() |
Similar Threads
- error in tcp:client/server (Perl)
- Client/Server sockets and reading a file (C++)
- need help with group compiling c/c++ programs (C++)
- Code to monitor port 135 on windows OS (Visual Basic 4 / 5 / 6)
- socket program (C)
- JDBC Driver for SQL Server 2005, Class not found Exception (Java)
- CGI, Tomcat, Perl, not compiling Perl code? (Perl)
- server notify client to update MySQL table (C)
- compiling from command line (Java)
- Samba browser (OS X)
Other Threads in the C Forum
- Previous Thread: Sorting without an array
- Next Thread: Processing keystrokes from keyboard
| Thread Tools | Search this Thread |
#include * adobe ansi array arrays asterisks binarysearch centimeter changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv feet fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez global grade gtkwinlinux hacking histogram inches include incrementoperators infiniteloop input interest intmain() iso kernel keyboard kilometer km linked linkedlist linux locate looping lowest matrix meter microsoft mqqueue number oddnumber open opendocumentformat openwebfoundation owf pattern pdf performance pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable voidmain() wab whythiscodecausesegmentationfault windowsapi






