Unix Sockets in Go

In your example client, you don’t seem to be reading the result from the server. When I add code to do that, I see the results from the server. Also, take a look at how I used defer and break to make the reader goroutine exit. Server package main import ( “log” “net” ) func … Read more

What’s the best way to synchronize times to millisecond accuracy AND precision between machines?

Just run the standard NTP daemon. It does have options to take input from several GPS devices as well as talking to network servers. Edit: I was referring to http://www.ntp.org/, not the one that comes with Windows. I don’t have any suggestion as to what NTP clients are best for windows, but for Unix machines … Read more

How did WhatsApp achieve 2 million connections per server?

If you have enough RAM it’s not too hard to handle 1M or more connections on linux. These guys handled 10 million connections with a java application on a single box using regular CentOS kernel with a few sysctl tweaks: sysctl -w fs.file-max=12000500 sysctl -w fs.nr_open=20000500 ulimit -n 20000000 sysctl -w net.ipv4.tcp_mem=’10000000 10000000 10000000′ sysctl … Read more

How is socket connection being handled in a forked process

First, accept() the incoming connection. The accepting process now has a handle to the listening socket, and the newly accepted socket. Fork and: In the child: Close the listening socket. Do stuff with the accepted socket. In the parent: Close the accepted socket. Resume the accept loop. The various socket resources will be reclaimed when … Read more

Which book(s) to learn sockets programming and TCP network communication? [closed]

This is the book to learn TCP/IP, doesn’t matter what language you will be using: W. Richard Stevens, TCP/IP Illustrated, Volume 1: The Protocols The following is the C network programmer’s bible, highly recommended: W. Richard Stevens, Unix Network Programming, Volume 1: The Sockets Networking API Out of online resources, Beej’s Guide to Network Programming … Read more