sockets

DNS Query Structure

When I am sending a DNS query to the DNS it returns the header with the format bit set. Indicating there is a problem with the format, but I am failing to see what it is. Its possible I have misinterpreted the RFC, or misread it but right now I cant seem to work it out. The DNS structure I am sending looks like this in hex. Header 00...

What limits the number of connections for a TCP port?

Lets say I have an application that is going to listen on a particular TCP port for a connection. Is there a theoretical limit on the number of connections that can be handled in the same port? Or is there only a practical limit based on the OS and other properties? I've searched the Internet but couldn't find a conclusive answer. Tha...

Descriptor passing with unix domain sockets

When we want to pass a descriptor from child to process, UNP V1(Unix network programming V1) specifies a complex procedure of doing this, first to create msghdr struct and then something, etc. Why cant we pass a descriptor as normal data means as we do send , recv for other data through unix domain sockets? I am able to understand the p...

Lazy sockets - scalability?

Asking more in theory, how could I build a server (or app) that uses lazy sockets? I'm envisioning a web app that moves all of its data via JSON exchanges to a central API-like servlet. I could leave the HTTP connection open for a bit after transferring all data, to write more to the client, as a sort of lazy push technology. The browser...

Java, Sockets Connections and HTTP Requests/Responses

In an application I need to use Socket connections as well as Http requests/responses in Java, I have done some work with Tomcat but I think it handles only HTTP requests/responses. I was thinking of using Java Networking(java.net.Socket and java.net.ServerSocket), make a jar and run it on the server to handle the sockets and use Apache...

C# socket problem

I am creating a socket server in C# and a client in PHP. The conversation between client and server is something like this: client connects server sends welcome message client sends data server sends response (repeat step 3 - 4 until client disconnects) It works until step 3. The data from the client is received by the server. Howeve...

Non blocking socket from within a DLL (no window)

Hi all, I have a DLL wich connects to a server through a single socket. I am facing the following problem : If server's IP address & port are false or server is down, the application using this DLL freezes until half a minute. My idea is to use non-blocking sockets to avoid that problem, by showing a window indicating connection progres...

TCP Server not reading from socket untill objects disposed

Hi, Please excuse my choice of wording and/or mixup of terms, I am a dummy when it comes to socket programming. I am trying to connect to a TCP server, write a message and process a response. I use the following code: Dim tcpClient As Sockets.TcpClient = New TcpClient() tcpClient.Connect(hostname, 9080) Dim networkStream As NetworkSt...

Ways to prevent broken pipe?

ClientAbortException: java.net.SocketException: Broken pipe If I am wright, this happens when user aborts current operation or makes another request, before the last one is finished. Can this reflects on browsing user or is this (always) just a Catalinas exception? Are there any ways to avoid this exception? ...

what is the difference between read() and recv() , and between send() and write() ?

what is the difference between read() and recv() , and between send() and write() in socket programming ? performance and speed and other behavior. ...

Packet Queue in Python?

Hi, is there any way to queue packets to a socket in Python? I've been looking for something like the libipq library, but can't find anything equivalent. Here's what I'm trying to accomplish: Create tcp socket connection between server and client (both under my control). Try transmitting data (waiting for connection to fault -- e.g. ...

Why is separate getaddrinfo-like() + connect() not refactored into a (theoretical) connect_by_name() ?

Most of the applications I've seen that use TCP, do roughly the following to connect to remote host: get the hostname (or address) from the configuration/user input (textual) either resolve the hostname into address and add the port, or use getaddrinfo() from the above fill in the sockaddr_* structure with one of the remote addresses u...

Check connection open or closed ?(in c in Linux)

In socket programming in Linux I need to write data in socket but I don't know socket is open or close . how to I know that socket is open and close without read ? printf("befor read%d\n", n); bzero(buffer, MAX_SIZE_BUFFER); n = read(sockfd, buffer, MAX_SIZE_BUFFER - 1); printf("after read%d\n", n); if (n <= 0) { break; } printf("be...

sockets in objective-c

I'm using gcc for compiling and linking Objective-C programs, and I'm wondering if there is socket library that is unified, portable, and/or cross-platform (like Python's socket module). ...

Where can I find benchmarks on different networking architectures?

Where can I find benchmarks on different networking architectures? I am playing with sockets / threads / forks and I'd like to know what the best is. I was thinking there has got to be a place where someone has already spelled out all the pros and cons of different architectures for a socket service, listed benchmarks with code that run...

Any good website teaches datagram sockets use in Java?

I want to program in Java some application that would use sockets, specially UDP sockets, do you have by chance any good website where I can find some resources ? ...

How can I tell if a socket buffer is full?

How can I tell if a read socket buffer is full or a write socket buffer is empty? Is there a way I can get the status of a socket buffer without a system call? UPDATE: How about this: I'd like to get a callback or signal when either the read socket buffer is full or the write socket buffer is empty. This way I can stop processing to al...

Reading socket buffer using asyncore

I'm new to Python (I have been programming in Java for multiple years now though), and I am working on a simple socket-based networking application (just for fun). The idea is that my code connects to a remote TCP end-point and then listens for any data being pushed from the server to the client, and perform some parsing on this. The da...

Socket: Client was disconnected or not?

I am creating socket server. But I do not know, How I can know client disconnected or not? I am creating server under Windows and using berkeley sockets function (read, send, connect....). Preferably I want a cross-platfomennoe solution (without WSA functions). I can write to socket 0 byte and ckeck error. But it is not good solution. ...

Socket available data for read

I need fast method for check socket has available data for read. I use select(), but it is not fast. Is faster method exists? ...