I lied!!! i have the start of a server code, it isnt the best, but i pieced it together from about 4 diff tutorials, and sources, removed the win32 or *nix "choices" and fixed a few probs with the linker libs from a few of the other sources.
how bad does this look, and what is next for server side? thank you
Code:
#include<stdio.h>
#include<winsock2.h>
#include<windows.h>
#pragma lib "Ws2_32.lib"
int main(void)
{
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2, 2);
SOCKET m_socket;
if ((WSAStartup(wVersionRequested, &wsaData)) != 0)
{
printf("The Winsock dll not found!\n");
return 0;
}
m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (m_socket == INVALID_SOCKET)
{
printf("Error at socket(): %ld.\n", WSAGetLastError());
WSACleanup();
return 0;
}
struct sockaddr_in service;
service.sin_family = AF_INET;
service.sin_addr.s_addr = inet_addr("127.0.0.1");
service.sin_port = htons(55555);
if (bind(m_socket, (SOCKADDR*)&service, sizeof(service)) == SOCKET_ERROR)
{
printf("bind() failed: %ld.\n", WSAGetLastError());
closesocket(m_socket);
return 0;
}
if (listen(m_socket, 1) == SOCKET_ERROR)
{
printf("listen(): Error listening on socket %ld.\n", WSAGetLastError());
}
else
{
printf("I'm waiting for connections...\n");
}
return 0;
}