Uhm, just wondering what's wrong with the code:
Btw, I have my own ircd that I downloaded..Code:#include <stdio.h> #include <winsock.h> int main(int argc, char *argv[]) { WSADATA wsaData; if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) return 0; SOCKET hSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (hSocket == INVALID_SOCKET) { WSACleanup(); return 0; } SOCKADDR_IN sockAddr; sockAddr.sin_port = htons(6667); sockAddr.sin_addr.s_addr = inet_addr("127.0.0.1"); sockAddr.sin_family = AF_INET; if (connect(hSocket, (SOCKADDR *)&sockAddr, sizeof(sockAddr)) != 0) { WSACleanup(); return 0; } char buffer[260], temp[260]; while (1) { int bytesRcv = recv(hSocket, buffer, sizeof(buffer), 0); if (bytesRcv != 0 || bytesRcv != SOCKET_ERROR) { printf("%s", buffer); if (strstr(buffer, "No ident response") != NULL) { sprintf(temp, "USER something something something :something"); send(hSocket, temp, strlen(temp), 0); sprintf(temp, "NICK something"); send(hSocket, temp, strlen(temp), 0); } } else break; } return 0; }
After receiving the message "No ident response", it should send a "user" and "nick" message and then after that the server should send me back a "ping" message..
Thanks in advance..![]()



LinkBack URL
About LinkBacks




