Thursday, 8 August 2013

How to use pthreads for sending and receiving in a udpclient in C

How to use pthreads for sending and receiving in a udpclient in C

I'm trying to modify a client program so that it will use pthreads for the
functions sendto() and recvFrom() but I get an error:
/tmp/cciYoHsc.o:udpclient.c:(.text+0x253): undefined reference to
`_sendMessage'
/tmp/cciYoHsc.o:udpclient.c:(.text+0x2f2): undefined reference to
`_recvMessage'
collect2: ld returned 1 exit status
I think it might have something to do with all the ifdef/endif keywords.
I'm not really sure what all they do. This is my program udpclient.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#ifdef WIN
#include <winsock.h>
#include <windows.h>

No comments:

Post a Comment