LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-05-2005, 03:22 PM   #1
maritos
LQ Newbie
 
Registered: Oct 2005
Posts: 5

Rep: Reputation: 0
threads web server in c


Hi i have a problem with my code, if anyone here can help.
ok i create a thread that executes a function that receives a browser request and put it in a buffer. I create another thread that read the request from the buffer and sends the correct answer.
The problem is that he never executes the function of read_answer, he passes that function and the prog terminates.

Code:
(void *) receive() {
  Here i create the socket, make him accept a connection
  and put the request in a buffer.
}

(void *) read_answer() {
  Here i read the request and then send the answer.
}



main() {

pthread_t thread,thread1
		
pthread_create(&thread, NULL, (void *)&receive,NULL);
	
while(1){
	pthread_create(&thread1, NULL,(void *)&read_answer,NULL);
}
 
Old 12-07-2005, 01:11 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
http://www.cs.utah.edu/~swalton/list...kets/programs/ for a nice list of socket programs. One of them is echo-thread.c
 
  


Reply

Tags
examples, network, programming, threads



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cant make web server run my local web page... Nik0s Linux - Newbie 22 10-08-2006 10:30 PM
can we configure a Linux server with mail server,file server and web server kumarx Linux - Newbie 5 09-09-2004 06:21 AM
adding more web servers to make web server farm linuxboy69 Linux - Networking 5 07-09-2004 09:50 AM
setting up password protected web forms on an apache web server AZDAVE Linux - Security 3 07-07-2004 12:03 PM
Can't access Linux web server web pages from LAN client jaydave Linux - Networking 4 03-16-2003 02:38 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration