Skip to content
Advertisement

Tag: network-programming

Why does netstat show the wrong foreign address?

I have several physical network interfaces on a debian 6 box, each has a different subnet IP address. Two of the interfaces are connected to a switch hub so they can communicate with each other. I want to setup a TCP connection between the 2 interfaces. This is what I do: I first get a SOCK_STREAM socket. I then use

How to debug the network stack in linux

I am trying to inject a packet into the network using raw sockets, but somehow can’t seem to get a receiver to capture this packet. How do i check whether the packet is being dropped by the linux network stack? Could someone point out some tools for doing this? Answer I don’t know about accessing the network stack directly (not

How to completely destroy a socket connection in C

I have made a chat client in linux using socket, and i wish to destroy the connection completely. Following is the relevant portions of the code: but the close(sock) doesnot seem to close the destroy the connection completely, because after going to ‘label’ the code is exiting showing the error message That is the connection is not happening again. What

Does epoll(), do its job in O(1)?

Wikipedia says unlike the older system calls, which operate at O(n), epoll operates in O(1) [2]). http://en.wikipedia.org/wiki/Epoll However, the source code at fs/eventpoll.c on Linux-2.6.38, seems it is implemented with an RB tree for searching, which has O(logN) In fact, I couldn’t see any man page saying the complexity of epoll() is O(1). Why is it known as O(1)? Answer

Socket data length questions

I have a couple of questions related to the following code: The questions: Why I read 255 not 256 ? Let’s say I want to send the word: “Cool” from the client to the server. How many bytes should I write “in client” and how many bytes should i read “in the server”? I’m really confused. Answer You already have

Advertisement