Ok well I'm making a console msn client.
#pragma comment(lib, "wsock32.lib ")
#include <windows.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
int main(){
char buf[12];
WSAData wsdata;
WORD wsver=MAKEWORD(2, 0);
int nret=WSAStartup(wsver, &wsdata);
if(nret != 0){
std::cout<<"Startup failed, error code: "<<WSAGetLastError();
WSACleanup();
return -1;
}
std::cout<<"Init success\n";
SOCKET kSock=socket(AF_INET, SOCK_STREAM, 0);
if(kSock == INVALID_SOCKET){
std::cout<<"Socket init failed";
return -1;
}
std::cout<<"Socket initialized\n";
sockaddr_in sin;
sin.sin_port=htons(1863);
sin.sin_addr.s_addr=inet_addr("64.4.9.254");
sin.sin_family=AF_INET;
if(connect(kSock,(sockaddr*)&sin, sizeof(sin)) == SOCKET_ERROR){
std::cout<<"Connect failed, error: "<<WSAGetLastError();
WSACleanup();
return -1;
}
std::cout<<"Connection successful!\n\n";
char text[] = "VER 1 MSNP18 MSNP17 CVR0\n\r";
send(kSock, text, sizeof(text), 0);
printf(">>Client: %s\n",text);
recv(kSock,buf, sizeof(buf), 0);
printf("<<Server: %s\n",buf);
memset( buf, 0, sizeof(buf) );
puts (buf);
char text1[] = "CVR 2 0x040c winnt 5.1 i386 MSNMSGR 14.0.8064.0206 msmsgs MYEMAILHERE\n\r";
send(kSock, text1, sizeof(text1), 0);
printf(">>Client: %s\n",text1);
recv(kSock, buf, sizeof(buf), 0);
printf("<<Server: %s\n",buf);
closesocket(kSock);
return 0;
}
What this should do is:
Sends "VER 1 MSNP18 MSNP17 CVR0\n\r"
MSN server will reply with "VER 1 MSNP18"
Buffer is Flushed
Sends "CVR 2 0x040c winnt 5.1 i386 MSNMSGR 14.0.8064.0206 msmsgs MYEMAILHERE\n\r"
Server will then reply with something.
What actually happens is:
first command is sent
server replies with "VER 1 MSNP18"
Buffer is Flushed
Second command sent
the buffer remains empty and no response from server is displayed
I'm lost maby you guys would know how to help?
P.S i think it's a problem with my code i don't think the server sends an empty response.