socket.emit() vs. socket.send()

With socket.emit you can register custom event like that: server: var io = require(‘’).listen(80); io.sockets.on(‘connection’, function (socket) { socket.emit(‘news’, { hello: ‘world’ }); socket.on(‘my other event’, function (data) { console.log(data); }); }); client: var socket = io.connect(‘http://localhost’); socket.on(‘news’, function (data) { console.log(data); socket.emit(‘my other event’, { my: ‘data’ }); }); Socket.send does the same, but … Read more

Python Socket Multiple Clients

Based on your question: My question is, using the code below, how would you be able to have multiple clients connected? I’ve tried lists, but I just can’t figure out the format for that. How can this be accomplished where multiple clients are connected at once and I am able to send a message to … Read more

Chrome hangs after certain amount of data transfered – waiting for available socket

Explanation: This problem occurs because Chrome allows up to 6 open connections by default. So if you’re streaming multiple media files simultaneously from 6 <video> or <audio> tags, the 7th connection (for example, an image) will just hang, until one of the sockets opens up. Usually, an open connection will close after 5 minutes of … Read more

Difference between socket and websocket?

To answer your questions. Even though they achieve (in general) similar things, yes, they are really different. WebSockets typically run from browsers connecting to Application Server over a protocol similar to HTTP that runs over TCP/IP. So they are primarily for Web Applications that require a permanent connection to its server. On the other hand, … 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