Client on Node.js: Uncaught ReferenceError: require is not defined

This is because require() does not exist in the browser/client-side JavaScript. Now you’re going to have to make some choices about your client-side JavaScript script management. You have three options: Use the <script> tag. Use a CommonJS implementation. It has synchronous dependencies like Node.js Use an asynchronous module definition (AMD) implementation. CommonJS client side-implementations include … Read more

TypeError: ‘module’ object is not callable

socket is a module, containing the class socket. You need to do socket.socket(…) or from socket import socket: >>> import socket >>> socket <module ‘socket’ from ‘C:\Python27\lib\socket.pyc’> >>> socket.socket <class ‘socket._socketobject’> >>> >>> from socket import socket >>> socket <class ‘socket._socketobject’> This is what the error message means: It says module object is not callable, … Read more

How do SO_REUSEADDR and SO_REUSEPORT differ?

Welcome to the wonderful world of portability… or rather the lack of it. Before we start analyzing these two options in detail and take a deeper look how different operating systems handle them, it should be noted that the BSD socket implementation is the mother of all socket implementations. Basically all other systems copied the … Read more

What does “connection reset by peer” mean?

It’s fatal. The remote server has sent you a RST packet, which indicates an immediate dropping of the connection, rather than the usual handshake. This bypasses the normal half-closed state transition. I like this description: “Connection reset by peer” is the TCP/IP equivalent of slamming the phone back on the hook. It’s more polite than … Read more

tech