heh i know i''m probably annoying you guys
![](wink.gif)
but I really need help lol. Then again what''s this forum for?
![](smile.gif)
anyways here''s my code:
#include <stdio.h>
#include <winsock2.h>
#include <iostream.h>
int main(int argc, char* argv[])
{
cout <<"The Nonamed Game Server Version 0.1a\nBy:Matthew Shapiro\n\n";
sockaddr_in me;
WSADATA wsaData;
SOCKET s;
char *namebuf;
char *passbuf;
sizeof(namebuf)[25];
sizeof(passbuf)[25];
char username;
char password;
int nRet = 0;
if((nRet = WSAStartup(MAKEWORD(2,0), &wsaData)))
{
switch(nRet)
{
case WSASYSNOTREADY:
printf("WSASYSNOTREADY\n");
case WSAVERNOTSUPPORTED:
printf("WSAVERNOTSUPPORTED\n");
case WSAEINPROGRESS:
printf("WSAEINPROGRESS\n");
case WSAEPROCLIM:
printf("WSAEPROCLIM\n");
case WSAEFAULT:
printf("WSAEFAULT\n");
}; return 1;
}
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == INVALID_SOCKET)
{
printf("socket() failed; %d\n", WSAGetLastError());
return 1;
}
me.sin_family = AF_INET;
me.sin_port = htons(5151);
me.sin_addr.s_addr = htonl(INADDR_ANY);
cout <<"Testing\n";
if (bind(s, (SOCKADDR *)&me, sizeof(me)) == SOCKET_ERROR)
{
cout <<"bind() failed: ";WSAGetLastError();
return 1;
}
int err = recv(s,namebuf,sizeof(namebuf),0);
if (err==0 || err==INVALID_SOCKET)
{
cout <<"Couldn''t recieve username: "<<WSAGetLastError()<<''\n'';
return 1;
}
username;
err = recv(s,passbuf,sizeof(passbuf),0);
if (err==0 || err==INVALID_SOCKET)
{
cout <<"Couldn''t recieve password: "<<WSAGetLastError()<<''\n'';
return 1;
}
cout <<"everything works right now\n";
password;
return 1;
}
and here are the warnings it''s producing that seem to make it give me the 10014 error:
[qoute]
E:\Programming\Test\grr.cpp(48) : warning C4700: local variable ''namebuf'' used without having been initialized
E:\Programming\Test\grr.cpp(55) : warning C4700: local variable ''passbuf'' used without having been initialized
Linking...
grr.exe - 0 error(s), 2 warning(s)
heh any ideas on how to make this work?
(btw my computer seems really screwed up and for some reason doing things like "char *namebuff=new char[25]; hangs the program at startup so that won''t work. Any ideas?