What is the actual impact of calling socket.recv with a bufsize that is not a power of 2?

I’m pretty sure the ‘power of 2’ advice is based on an error in editing, and should not be taken as a requirement. That specific piece of advice was added to the Python 2.5 documentation (and backported to Python 2.4.3 docs), in response to Python issue #756104. The reporter was using an unreasonably large buffer … Read more

node.js – handling TCP socket error ECONNREFUSED

I ran the following code: var net = require(‘net’); var client = net.connect(5558, ‘localhost’, function() { console.log(“bla”); }); client.on(‘error’, function(ex) { console.log(“handled error”); console.log(ex); }); As I do not have 5558 open, the output was: $ node test.js handled error { [Error: connect ECONNREFUSED] code: ‘ECONNREFUSED’, errno: ‘ECONNREFUSED’, syscall: ‘connect’ } This proves that the … Read more

What are meanings of fields in /proc/net/dev?

You can have a look at net/core/dev.c in the source tree to see what it means: seq_printf(seq, “%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ” “%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n”, dev->name, stats->rx_bytes, stats->rx_packets, stats->rx_errors, stats->rx_dropped + stats->rx_missed_errors, stats->rx_fifo_errors, stats->rx_length_errors + stats->rx_over_errors + stats->rx_crc_errors + stats->rx_frame_errors, stats->rx_compressed, stats->multicast, stats->tx_bytes, stats->tx_packets, stats->tx_errors, stats->tx_dropped, … Read more

Simple HTTP/TCP health check for MongoDB

I’ve created a simple health check for mongodb, it uses the mongo client to send a simple query request (eg. db.stats()) to the server. $ mongo 192.168.5.51:30000/test MongoDB shell version: 3.2.3 connecting to: 192.168.5.51:30000/test mongos> db.stats() { “raw” : { “set1/192.168.5.52:27000,192.168.5.53:27000” : { “db” : “test”, “collections” : 8, “objects” : 50, “avgObjSize” : 73.12, … Read more

What is the reason and how to avoid the [FIN, ACK] , [RST] and [RST, ACK]

Here is a rough explanation of the concepts. [ACK] is the acknowledgement that the previously sent data packet was received. [FIN] is sent by a host when it wants to terminate the connection; the TCP protocol requires both endpoints to send the termination request (i.e. FIN). So, suppose host A sends a data packet to … Read more

Why does a SYN or FIN bit in a TCP segment consume a byte in the sequence number space?

It’s not particularly subtle – it’s so that the SYN and FIN bits themselves can be acknowledged (and therefore re-sent if they’re lost). For example, if the connection is closed without sending any more data, then if the FIN did not consume a sequence number the closing end couldn’t tell the difference between an ACK … Read more

Create a virtual serial port connection over TCP

Try socat. Possible scenario: socat pty,link=/dev/virtualcom0,raw tcp:192.168.254.254:8080& socat creates TCP connection to 192.168.254.254:8080, so that everything, that will be written to /dev/virtualcom0 will be forwarded to 192.168.254.254:8080 and vice versa. Another approach would be to use RFC2217 via ser2net on Linux sever side and RFC2217 driver on Windows side (for example http://www.hw-group.com/products/hw_vsp/index_en.html single port version). … Read more

netstat showing foreign ports as kubernetes:port. What does this mean?

That happens because of the way netstat renders output. It has nothing to do with actual Kubernetes. I have Docker Desktop for Windows and it adds this to the hosts file: # Added by Docker Desktop 192.168.43.196 host.docker.internal 192.168.43.196 gateway.docker.internal # To allow the same kube context to work on the host and the container: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)