?
Solved

linux network programming

Posted on 2005-03-09
4
Medium Priority
?
418 Views
Last Modified: 2008-02-01
hi
i am new to linux network programming. I am facing problem in making threaded TCP Server. I have used pthread.h in the main program. but i am getting error like this ->
)
[root@www CSockets]# gcc -o thread TCPEchoServer-Thread.c
/tmp/ccmibAQF.o(.text+0xb4): In function `main':
: undefined reference to `pthread_create'
/tmp/ccmibAQF.o(.text+0xfa): In function `ThreadMain':
: undefined reference to `pthread_detach'
collect2: ld returned 1 exit status
 How can I remove these error from my program. Are pthread_create() and pthread_detach are not member of pthread.h or how can i replace these functions.
 pls quick hint or suggest. U are welcome.
0
Comment
Question by:effectivista
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Expert Comment

by:dog_
ID: 13495137
I'm not a linu programmer but I would say that it does not know where to look for the pthread_detach and pthread_create functions. Check these ideas:

is pthread.h included in the main?
make sure your include path has the path to the directory with pthread.h in it.
try putting a copy of pthread.h in you working directory
0
 
LVL 3

Accepted Solution

by:
Chipzter earned 375 total points
ID: 13496028
Try running "gcc -o thread -l pthread TCPEchoServer-Thread.c" instead to link to the pthread library.
0
 

Author Comment

by:effectivista
ID: 13503555
hi Chipzter

i tried to compile with command given by u. It works.
thank u. I want to know about UDP server also. i want to create a concurrent UDP server
how can i do this. any idea pls :->
)
 
0
 
LVL 3

Expert Comment

by:Chipzter
ID: 13503798
run "man recvfrom" or check this tutorial: http://www.linuxgazette.com/node/8758
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question