Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

More Winsock Help


ghost's Avatar
0 0

I have been continuing work on my winsock. My latest project is to make a program that will fetch the login prompt text from my router's(192.168.1.1) telnet prompt.The code mentioned below executes but shows a string I cannot make any sense of(its the same string always).

#include<windows.h>
main()
{
      
      
WSADATA wsaData;
int starterr = WSAStartup(MAKEWORD(2,2), &wsaData);
SOCKET mysock = socket(AF_INET,SOCK_STREAM,0);
sockaddr_in anews;
anews.sin_port = htons(23);
anews.sin_addr.s_addr = inet_addr("192.168.1.1");
anews.sin_family = AF_INET;
connect(mysock,(sockaddr*)&anews, sizeof(anews));
char buf[200];
recv(mysock, buf, sizeof(buf), 0);
MessageBox(0,buf,"sd",0);
}

Thanks in advance for any suggestions.:)


ghost's Avatar
0 0

popen


ghost's Avatar
0 0

popen