No C++, just C, raw sockets. Working examples only which demonstrate a basic socket connection between 2 endpoints.
This will include: 1. Socket Data Storage Location For Alternative Server Input Command 2. IP Address of connection 3. Port Address of connection 4. Connect command 5. Close Socket command
Rip no-one knows. Or the people that do know are dead...
Luis Morris
Ive been working mostly on linux, but if I remember correctly theres almost no difference for simple tasks as described in your list. I think only WSA setup needs to be done. Others can correct me.
Andrew Long
>windows good luck
Carson Scott
#include
Tyler Fisher
Provide a working example.
Samuel Morgan
Do your own homework nigger
Asher Ortiz
>raw sockets This means something else
Austin Hill
why? I don't owe you nothing Do your own research you mongoloid or provide your code and point out why do you think it doesn't work
John Ramirez
beej.us/guide/bgnet/ beej is a sperg so the section on translating things to Windows reads as you'd expect, but the guide is still very good
// send string void sendstring(const char *s) { int pos = 0, len = strlen(s); // Only small messages supported now, // need to improve this send(sockfd, s, len, 0); }
int main() { struct sockaddr_in dest; // Open socket if ( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) { perror("Create socket error"); exit(errno); }
// Initialize server address/port struct bzero(&dest, sizeof(dest)); dest.sin_family = AF_INET; dest.sin_port = htons(PORT_INT); if ( inet_aton(SERVER_ADDR, &dest.sin_addr.s_addr) == 0 ) { perror("Cannot understand \""SERVER_ADDR); exit(errno); } #if 0 // if you wish to enable non-blocking mode, enable this #endif // Connect to server if ( connect(sockfd, (struct sockaddr*)&dest, sizeof(dest)) != 0 ) { perror("connect"); exit(errno); }
// Example: login to router and replace route waitforstring("ogin: "); sendstring("admin\n"); waitforstring("assword: "); sendstring("admin\n"); waitforstring(">"); sendstring("sh -c \"route del default;route add default ppp1\"\n"); waitforstring(">"); close(sockfd); return 0; }
Dominic Price
windows sockets use same BSD sockets maybe just slightly different function prototypes as we used to in Linux or any other *nix systems
Still working out Windows's shitty SSL library (schannel) myself user, its hardly documented. The actual winsock implementation is nearly the same as on Linux/BSD however. Godspeed.
Thomas Wood
Ok I tried this but got undefined reference to 'WinMain@16'
Owen Peterson
By belting out the required calls to winsock.dll. It even has BSD-compatible aliases (connect(), send(), etc) - though you probably want to use the WSA*() versions if you don't care about portability - they're way faster if you use I/O completion ports.
Eli Morris
daily homework thread
Chase Williams
Bump.
Levi Jenkins
I am not doing your networks homework, just google it and copy pajeet's work