Junior — Middle
What knowledge and practical experience do you have in working with network settings and protocols in Linux?
sobes.tech AI
Answer from AI
I have basic knowledge and practical experience with network settings and protocols in Linux. I can configure network interfaces using ifconfig and ip, manage routes via route and ip route.
I am also familiar with the basics of TCP/IP, UDP, ICMP protocols, and can use utilities like ping, traceroute, netstat, and ss for network diagnostics. In C/C++ projects, I have implemented simple network applications using sockets (BSD sockets), which helped me understand client-server interaction principles.
Example of a simple TCP client in C++:
#include <iostream>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
int main() {
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
std::cerr << "Socket creation error\n";
return 1;
}
sockaddr_in serv_addr{};
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(80); // HTTP port
if(inet_pton(AF_INET, "93.184.216.34", &serv_addr.sin_addr) <= 0) { // example.com
std::cerr << "Invalid address\n";
return 1;
}
if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
std::cerr << "Connection Failed\n";
return 1;
}
std::cout << "Connected to server\n";
close(sock);
return 0;
}