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

Setting the source IP for a UDP socket

Nikolai, using a separate socket and bind(2) for each address or messing with routing tables is often not a feasible option e.g. with dynamic addresses. A single IP_ADDRANY-bound UDP server should be able to appear to respond on the same dynamically-assigned IP address a packet is received on. Luckily, there is another way. Depending on … Read more

What’s the difference between WebSocket and plain socket communication?

webSockets and regular sockets are not the same thing. A webSocket runs over a regular socket, but runs its own connection scheme, security scheme and framing protocol on top of the regular socket and both endpoints must follow those additional steps for a connection to even be made. You can see the webSocket protocol here: … Read more

Why is INET6_ADDRSTRLEN defined as 46 in C?

Why is INET6_ADDRSTRLEN defined as 46 in C? Because POSIX defines it to be 46: INET6_ADDRSTRLEN 46. Length of the string form for IPv6. While you are right that longtest IPv6 address takes 39 bytes, with IPv4 tunneling, the longest form can be 45 bytes: ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255 And the 46th byte is for the terminating nul … Read more

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