Hey guys, I'm really new to network programming and cant seem to get this program to work.
I tried writing this into pico, on a UNIX server at school and used a gcc compiler. I get the following error:#include <string.h>
#define DEST_IP "10.12.110.57"
#define DEST_PORT 23
struct sockaddr_in dest_addr; // will hold the destination addr
sockfd = socket(PF_INET, SOCK_STREAM, 0); // do some error checking!
dest_addr.sin_family = AF_INET; // host byte order
dest_addr.sin_port = htons(DEST_PORT); // short, network byte order
dest_addr.sin_addr.s_addr = inet_addr(DEST_IP);
memset(&(dest_addr.sin_zero), '\0', 8); // zero the rest of the struct
// don't forget to error check the connect()!
connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr));
Undefined First referenced
symbol in file
id: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
I'm really not sure what I'm doing wrong here. btw, this is directly writen from http://beej.us/guide/bgnet/output/html/syscalls.html ... I'm not taking credit for this persons work, just my way of learning is retyping it myself while explaining it to myself. Any help on why this isn't working would be great.