The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
NFS write failed for server.....error 11 (RPC: Server can't decode arguments) sap4ever SUN Solaris 3 05-08-2008 05:20 AM
Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server madhunk UNIX for Dummies Questions & Answers 5 01-31-2008 10:30 AM
Axigen, A Fresh Approach for Mail Server Admins - Server Watch iBot UNIX and Linux RSS News 0 07-12-2007 02:20 PM
Transfer file from local unix server to remote server indira Shell Programming and Scripting 2 05-03-2007 03:35 AM
Dowloading a File from FTP Server to a local Server where User Id's are different ranjith_taurean Shell Programming and Scripting 1 02-22-2007 04:47 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 12-09-2001
Gee Gee is offline
Registered User
 

Join Date: Dec 2001
Posts: 2
Question HELP (http server?)

Could anyone provide me with the source code for a simple multithreaded server in C that uses UNIX system calls, implementing only the GET command. Or point me to a location where I can view such source code?

any help will save my bacon!

Regards Gee

Last edited by Gee; 12-10-2001 at 03:34 PM.
Reply With Quote
Forum Sponsor
  #2  
Old 12-10-2001
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
What kind of server? What are you trying to accomplish? You mention 'GET' are you asking about a web (HTTP) server?
Reply With Quote
  #3  
Old 12-10-2001
Gee Gee is offline
Registered User
 

Join Date: Dec 2001
Posts: 2
reply to PxT

Thanks for having a look at my post, sorry i forgot to mention that it is a very simple multithreaded http server I am trying to find the source code for.

All I want it to do is listen at port 8080.

When I point my browser to http://localhost:8080/ it will display my home directory.

I am very new to Unix and network programming and any help would be greatly appreciated.

Regards Gee.
Reply With Quote
  #4  
Old 12-10-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
Why you wouldn't use Apache I don't know but...

If you want to "play" with an httpd server, try...

http://hoohoo.ncsa.uiuc.edu/

...you can download the source. It's small, fairly complete
but totally unsupported.
Reply With Quote
  #5  
Old 12-14-2001
Registered User
 

Join Date: Dec 2001
Location: UK
Posts: 23
Threads in unix are very simple and are created by the the system call pthread_create. The complete format of the system call is pthread_create(pthread_t *pid, const pthread_attr_t *attr, void *(*func) (void*), void *arg). The pid is the thread ID, the attr is the attributes, usually set to zero (NULL), the func is a pointer to the function that will execute first, and the arg is a pointer to the arguments of that function. Your programme must use first the socket() system call, to establish a socket, then call bind() to bind that socket to a sockaddr_in, then call listen() to make this socket a lstening socket and then call accept(). After accept you will call the pthread_create to handle the connection. It is a good idea to use the manual pages to get more information for the previously mentioned system calls (e.g type man pthread_create).
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:21 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0