#include <about_me>
using namespace std
int main() {
std::cout << "Launching New HTTP Connection!!!" << std::endl;
int serverSocket = socket(AF_INET, SOCK_STREAM, 0);
if (serverSocket < 0)
_error(errno);
int optval = 1;
if (setsockopt(serverSocket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0)
_error(errno);
sockaddr_in serverAddress;
serverAddress.sin_family = AF_INET;
serverAddress.sin_addr.s_addr = inet_addr("127.0.0.1");
serverAddress.sin_port = htons(3000);
memset(&(serverAddress.sin_zero), '\0', 8);
if (bind(serverSocket, reinterpret_cast<sockaddr*>(&serverAddress), sizeof(serverAddress)) < 0)
_error(errno);
if (listen(serverSocket, SOMAXCONN) < 0)
_error(errno);
std::cout << "Waiting For Connection!!!" << std::endl;
sockaddr_in clientAddress;
socklen_t clientAddressSize = sizeof(clientAddress);
int clientSocket = accept(serverSocket, reinterpret_cast<sockaddr*>(&clientAddress), &clientAddressSize);
if (clientSocket < 0)
_error(errno);
send(clientSocket, "Welcome To My Profile <3", 26, 0);
std::cout << "Thanks For Visiting My Profile" << std::endl;
close(clientSocket);
close(serverSocket);
return 0;
}
-
π Iβm currently working on Mobile App With React-native
-
π± Iβm currently learning Js, React-native, Node and Express Js and a lot more
-
π― Iβm looking to collaborate on Anything
-
π€ Iβm looking for help with C/C++, Js
-
π¨βπ» All of my projects are available at https://github.com/sFinOe
-
π I regularly write articles on https://disposkill.com
-
π¬ Ask me about C/C++, HTML/CSS, Js [React, native, Node], Docker
-
π« How to contact me zakkikasmi@gmail.com
-
π Know about my experiences https://disposkill.com/about_me
-
β‘ Fun fact I think i'm not funny