• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 422
  • Last Modified:

linux network programming

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
effectivista
Asked:
effectivista
  • 2
1 Solution
 
dog_Commented:
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
 
ChipzterCommented:
Try running "gcc -o thread -l pthread TCPEchoServer-Thread.c" instead to link to the pthread library.
0
 
effectivistaAuthor Commented:
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
 
ChipzterCommented:
run "man recvfrom" or check this tutorial: http://www.linuxgazette.com/node/8758
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now