Jose Velasquez

Generation

generate functionSun, 18 Jun 2023

programa que haga un ping y diga hola si el pin funciona

#include <iostream> #include <winsock2.h> #include <WS2tcpip.h> #include <string> using namespace std; int main() { //Winsock Startup WSAData wsaData; WORD DllVersion = MAKEWORD(2, 1); if (WSAStartup(DllVersion, &wsaData) != 0) //If WSAStartup returns anything other than 0, then that means an error has occured in the WinSock Startup. { MessageBoxA(NULL, "WinSock startup failed", "Error", MB_OK | MB_ICONERROR); exit(1); } //Address to Ping string ip4address = "www.google.com"; int port = 80; //Create a socket, notice how we use the SOCKET type SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); //The sockaddr_in

Questions about programming?Chat with your personal AI assistant