Connect: Socket operation on non-socket

I see the problem. It’s this line: The == operator has precedence over the = operator. Look at the way you have the parentheses structured on that expression a bit more carefully to see what I mean. sockfd is getting initialize to “0” as a result of being assigned a boolean expression (socket(…) == -1). … Read more

What is AF_INET, and why do I need it?

AF_INET is an address family that is used to designate the type of addresses that your socket can communicate with (in this case, Internet Protocol v4 addresses). When you create a socket, you have to specify its address family, and then you can only use addresses of that type with the socket. The Linux kernel, for … Read more

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 (most of them require a build step before you … Read more

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 (most of them require a build step before you … Read more

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

Looks like you are hitting the limit on connections per server. I see you are loading a lot of static files and my advice is to separate them on subdomains and serve them directly with Nginx for example. Create a subdomain called img.yoursite.com and load all your images from there. Create a subdomain called scripts.yourdomain.com … Read more