|
-
Aug 6th, 2002, 05:30 PM
#1
Thread Starter
Fanatic Member
parsing
the attached text file has the protocol for the server.
im trying to get it to work in my code, but all of the messageboxes show up as blank when i run it, here to code:
Code:
CString CGameOrganizerDlg::Read() {
CString tot;
bool done=false;
char *tmp=NULL;
while(!done){
sock.Receive(tmp,1);
//MessageBox(tmp,"test");
if(tmp=='\x00'){
done=true;
} else{
tot+=tmp;
}
}
//MessageBox((LPCSTR)tot,"total");
return tot;
}
bool CGameOrganizerDlg::Query(GameInfo &ginfo, char *server_name, char type){
char *buffer=new char[6];
char *send=new char[];
unsigned short port = this->GetPort(server_name); //get port
CString servern = server_name; //server name(either ip or hostname)
CString serverinfo[6]; //server properties
int loc;
if((loc=servern.Find(';',0)) != -1){
servern=servern.Left(servern.GetLength() - loc);
}
sock.Create(port,SOCK_DGRAM,servern);
sock.Connect(servern,port);
Sleep(200);
//request for info would go here ---|
send = "ÿÿÿÿinfo\x00";
sock.Send(send,(int)strlen(send));
Sleep(200);
sock.Receive(buffer,4);
for(int i=0;i<6;i++){
serverinfo[i]=this->Read();
MessageBox((LPCSTR)serverinfo[i],(LPCSTR)serverinfo[i]);
}
return true;
feel free to comment on ineffeciency etc, its my first serious program
yes im using mfc
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Aug 6th, 2002, 05:36 PM
#2
Thread Starter
Fanatic Member
i added in somethign to get the last error, 10022, invalid argument.
any idea what that means?
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|