0

How can we create socket and deal with web http and https using c++?

Teach me to create a socket in c++ to deal with http and https post and get requests in c++

3rd Aug 2019, 2:03 PM
Rao Zubair
Rao Zubair - avatar
2 Réponses
+ 8
Rao Zubair Socket programming is done in C++ with the help of Unix network programming shell which is mostly done in Linux or Ubuntu. To do socket programming some protocol is used like TCP(transmission control protocol), UDP(User datagram protocol). For establishing of connection we have to make program for client and server individually by using IP address. Socket(),bind(), listen(), accept(),connect(), read(), write(), close are some function used for completing this task for making different type of socket like active, passive, stream, datagram raw and sequence packet socket etc., Tcp/ip is used for secured HTTPs transmission so you have to make socket using tcp protocol For this you have to include some library like #include<netdb.h> #include<unistd.h> #include<sys/socket.h> #include<netinet/in.h> #include<arpa/inet.h> And you have to define the port address generally more than 8000 as before that internal files of Os are present. #define PORT 8000
3rd Aug 2019, 2:31 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 8
For more information you can refer external resources like geeks for geeks. https://www.geeksforgeeks.org/socket-programming-cc/amp/
3rd Aug 2019, 2:33 PM
GAWEN STEASY
GAWEN STEASY - avatar