ehensens
asked on
Windows sockets as viewed from a linux programmer, oh my
Hi all,
So I'm a novice network programmer by any means, but still all the network programming I've ever done has been in Linux / Cocoa. So, I'm curious as to why I can't even create a socket in my new windows application. I'm sure there's something dreadfully and obviously wrong with it. Can someone tell me what it is? I am being told:
Error 5 error LNK2001: unresolved external symbol _socket@12 responder.obj Responder
Error 6 fatal error LNK1120: 1 unresolved externals
Thanks a bunch!
So I'm a novice network programmer by any means, but still all the network programming I've ever done has been in Linux / Cocoa. So, I'm curious as to why I can't even create a socket in my new windows application. I'm sure there's something dreadfully and obviously wrong with it. Can someone tell me what it is? I am being told:
Error 5 error LNK2001: unresolved external symbol _socket@12 responder.obj Responder
Error 6 fatal error LNK1120: 1 unresolved externals
Thanks a bunch!
#include <stdio.h>
#include <winsock.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
int main()
{
int MAXRECVSTRING = 255;
int sock;
struct sockaddr_in broadcastAddr;
unsigned int broadcastPort;
int recvStringLen;
broadcastPort = 8004;
sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock < 0)
{
printf("\nsocket() failed");
getch();
exit(0);
}
// Still much more to come...
return 0;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
#pragma comment(lib, "ws2_32.lib")