Reliable way of generating unique hardware ID

It seems to me that you should construct the unique ID corresponding to your requirements. This ID can be constructed as a hash (like MD5, SHA1 or SHA512) from the information which is important for you (some information about software and hardware component). You can make your solution more secure if you sign such hash … Read more

How to share semaphores between processes using shared memory

It’s easy to share named POSIX semaphores Choose a name for your semaphore #define SNAME “/mysem” Use sem_open with O_CREAT in the process that creates them sem_t *sem = sem_open(SNAME, O_CREAT, 0644, 3); /* Initial value is 3. */ Open semaphores in the other processes sem_t *sem = sem_open(SEM_NAME, 0); /* Open a preexisting semaphore. … Read more

WCF – Inspect the messages being sent/received?

To view the message contents you must add a source for System.ServiceModel.MessageLogging in your configuration file. The message tab in the Trace Viewer will show the full message for a particular service call. Here is a sample configuration file: <configuration> … <system.diagnostics> <sources> <source name=”System.ServiceModel” switchValue=”All” propagateActivity=”true”> <listeners> <add name=”traceListener” /> </listeners> </source> <source name=”System.ServiceModel.MessageLogging” … Read more

struct sockaddr_un vs. sockaddr

“struct sockaddr” is a generic definition. It’s used by any socket function that requires an address. “struct sockaddr_un” (a “Unix sockets” address) is a specific kind of address family. The more commonly seen “struct sockaddr_in” (an “Internet socket” address) is another specific kind of address family. The cast is what allows the sockets APIs to … Read more

Socket.IO Client Library in Python [closed]

Archie1986’s answer was good but has become outdated with socketio updates (more specifically, its protocol : https://github.com/LearnBoost/socket.io-spec)… as far as i can tell, you need to perform the handshake manually before you can ask for a transport (e.g., websockets) connection… note that the code below is incomplete and insecure… for one, it ignores the list … Read more

Does the port change when a server accepts a TCP connection?

The new socket is an application-level concept introduced because each established connection needs a unique file descriptor (also distinct from the listening file descriptor), which maps to, but isn’t the same as, a TCP session. The session itself is identified by the combination of source and destination address and port. The source (client) port is … Read more

java.io.InvalidClassException: local class incompatible:

If a class does not explicitly define a private static final long serialVersionUID in the code it will be autogenerated, and there is no guarantee that different machines will generate the same id; it looks like that is exactly what happened. Also if the classes are different in any way (using different versions of the … Read more

Does TCP send a SYN/ACK on every packet or only on the first connection?

It’s kinda like: +——————————————————-+ | client network server | +—————–+ +——————–| | (connect) | —- SYN —-> | | | | <– SYN,ACK — | (accepted) | | (connected) | —- ACK —-> | | \_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/ when client sends… \_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/ | | | | | (send) | —- data —> | | | | <—- … Read more