What is public and private IP address? – Real Scenarios

Public and private IP address explanation with example and real time scenarios. Public IP Address: Public IP Address is the IP that is unique and visible to the world. For example, “interviewsansar.com” website has a unique public IP address. Actually, Public IP addresses are registered by Internet standards groups e.g. NIC (Network Information Centre) and … Read more What is public and private IP address? – Real Scenarios

TCP Socket Client and Server in same language – Is it must?

Interview Question: Is it mandatory that TCP client and Server must be written in one language i.e. C, C++,C# or Java etc.? Can’t we connect TCP client written in one language to a server written in others? Answer: TCP socket client and TCP server both are independent of each other. We can write tcp client … Read more TCP Socket Client and Server in same language – Is it must?

Can TCP IP socket server and client run on same machine?

Answer: Yes, TCP/IP socket server and client applications can be executed on the same machine. TCP Client and server programs are two different and independent application. Just tcp client has to connect to correct address of the tcp server. It doesn’t matter if we are running tcp socket client program on same machine on which … Read more Can TCP IP socket server and client run on same machine?

What header files and libraries do you include for socket programming?

Answer: Below is the header files and pakage mentioned with respect to language/platform. Java: import java.net.*; //pakage. C# using System.Net; using System.Net.Sockets; using System.Net.NetworkInformation; C/C++ Windows        #include <winsock2.h>        #include <ws2tcpip.h> Need to link with Ws2_32.lib #pragma comment (lib, “Ws2_32.lib”) WinCE #include <winsock2.h> #include <ws2tcpip.h> Need to link with Ws2.lib #pragma comment(lib,”ws2.lib”) C/C++ Linux … Read more What header files and libraries do you include for socket programming?

What is static and dynamic IP address?

Static and dynamic IP address concept is important when we work on network related stuff / programming, for example Wi-Fi, Ethernet etc. Answer: Static and dynamic IP Address: Static IP Address: A static IP address is a fixed IP address that is manually assigned to a computer or a device on a network. Static IP … Read more What is static and dynamic IP address?

Can multiple TCP Servers run with same IP Address on a host?

Answer: Yes, we can create multiple TCP/IP servers using the same IP address on a machine. Actually, a tcp socket server is identified by unique combination of an IP address and a Port number. And, we can have many combinations of an IP address and Port numbers.   NOTES:  It is important to note that … Read more Can multiple TCP Servers run with same IP Address on a host?

What is ping command in networking?

Answer: Ping command in networking is a frequently used command to test if an IP Address or domain name exist in the network. Ping is a tool, a software utility that is used to verify that a particular IP address e.g “10.17.18.97” or domain name e.g. “interviewsansar.com” exist into the network and can accept requests. … Read more What is ping command in networking?

Tell me some situations where you have used socket in your project?

Answer: To answer this question, focus on your projects where you have used socket and I would recommend to make a note of all socket used situations. Some times in interview, on the fly we may not able to recollect many situations. If you quickly states many situations it gets interviewer, a confidence on your … Read more Tell me some situations where you have used socket in your project?

Where have you used UDP Socket Programming?

Answer: The answer is up to you if you have used UDP socket programming in your project. If you have not used in your project or you are a fresher, then you can say that you have not used, but you can answer the concept where we can use upd socket programming in real time … Read more Where have you used UDP Socket Programming?

What does bind() function do in TCP/UDP server?

Answer: Bind() function in socket programming is used to associate the socket with local address i.e. IP Address, port and address family. int bind(int sockfd,struct sockaddr *servaddr,int addrlength); There could be many combination of IP address and ports e.g. (10.17.18.19, 6400), (10.17.18.19, 6500), (10.17.18.19, 6600) and so on, a server can use. Let’s say we … Read more What does bind() function do in TCP/UDP server?