sockets

Need help in understanding the mapping of user-space send, sendto, sendmsg to kernel-space sendmsg

Hello, I am trying to implement my own transport layer protocol in Linux for an experiment. I am going to use socket interface and add my protocol using sock_register. For the proto_ops i can see that the parameters for the sendmsg and recvmsg are (struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags). But t...

Python TCP Server, writing to clients?

Hi I have a tcp server which uses the select call to multiplex reading from clients. I have a client class (MClient) which manages the decoding of incoming data packets while(1) rlist, wlist, xlist = select( input_sockets, output_sockets, [] , 1) for insock in rlist: #any clients???? if insock is server_socket: ...

Same socket getting created.

I have this piece of code where a server socket is created and is set to listen on a particular port number say 5005. Now once the accept socket function returns the socket that gets created is copied into the m_Socket variable and finally i shutdown the server socket named SocServer which was created locally. Now my question Is it poss...

Android - Over 3g which ports to use and is TCP best connection method?

As a communications method is TCP best way to get lots of data through to multiple android devices from another android device over 3g? Also are there recommended ports to use for 3g data transfer? I want to rule out using a web service intermediary as I want this app to be decentralised if possible. Cheers, James ...

Validity of a Socket

I have created a socket using the following lines of code and i get a valid socket and connection is established between the client and server machines. Is there a possibility that the socket becomes invalid due to network disturbances or any other reason. If so how do we check whether the socket is valid or not. SOCKET SocServer; ...

Preventing write into a socket before the other side accepted the request

I'm implementing an FTP like protocol in Linux (homework) and I came upon the following problem: the client may be able to connect() and write() before the other side managed to do accept() (but after it did listen()). How can I prevent the write operation from working without relying on passing messages like "accept succeeded, you can w...

How to determine IP used by client connecting to INADDR_ANY listener socket in C

I have a network server application written in C, the listener is bound using INADDR_ANY so it can accept connections via any of the IP addresses of the host on which it is installed. I need to determine which of the server's IP addresses the client used when establishing its connection - actually I just need to know whether they conne...

How to turn stream from Named Pipe into Socket Stream? (in C++ on Windows)

How to turn stream from Named Pipe into Socket Stream? (in on Windows) (Share all new data in pipe stream on socket)? ...

Sending compressed data via socket

Hi, I have to make a log server in java, and one task is to send the data compressed. Now I am sending it line by line in plain text, but I must compress it. The server handle "HTTP like" request. For example, I can get a log sending "GET xxx.log". This will entablish a TCP connection to the server, the server response with a header and ...

How to create client socket using domain name

Hi I am using java for socket programming. To create client socket I have to pass IP and port. But I want to create client socket by passing domain name and port whether its possible. My domain name refers to a static address internally. means i want to pass www.xyz.com instead of ip address. Thanks Sunil Kumar Sahoo ...

Java in browser... opening a socket

I don't mind presenting the user with permission dialogs... What's involved in opening a listening socket on a web page? ...

Socket send recv functions

I have created a socket using the following lines of code. Now i change the value of the socket i get like this m_Socket++; Even now the send recv socket functions succeeds without throwing SOCKET_ERROR. I expect that it must throw error. Am i doing something wrong. struct sockaddr_in ServerSock; // Socket a...

Maximum length of buffer in AF_UNIX socket

Hi all! I would like to know: when programming in C using a socket (AF_UNIX) is there any limit (in bytes) when sending or receiving to or from a socket? Thank you! —Albé ...

Read from socket

I need to read from an AF_UNIX socket to a buffer using the function read from C, but I don't know the buffer size. I think the best way is to read N bytes until the read returns 0 (no more writers in the socket). Is this correct? Is there a way to guess the size of the buffer being written on the socket? I was thinking that a socket...

Why to use local pipes instead of sockets for programs communication inside one computer?

Why to use local pipes instead of sockets for programs communication inside one computer? Has Any one FRESH stats on who is faster and how nmuch, what is more sequre or less? I have found a wary old and strange and scary one... http://home.iae.nl/users/mhx/pipes&socks.html There is a noticeable difference in performance between soc...

Checking for open ports in C/C++

There have been other questions regarding the subject of verifying the accessibility and accessibility of socket ports. How would one go about looking for a port to listen on dynamically in C/C++? The basic process I'm trying to accomplish is this: Client starts Client finds open port XYZ and listens on it. Client transmits a basic...

socket.error: [Errno 10054]

import socket, sys if len(sys.argv) !=3 : print "Usage: ./supabot.py <host> <port>" sys.exit(1) irc = sys.argv[1] port = int(sys.argv[2]) sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sck.connect((irc, port)) sck.send('NICK supaBOT\r\n') sck.send('USER supaBOT supaBOT supaBOT :supaBOT Script\r\n') sck.send('JOIN #darkundergro...

python streaming TCP server with RPC

I have written a little streaming mp3 server in python. So far all it does is accept a ServerSocket connection, and begin streaming all mp3 data in its queue to the request using socket.send(). I have implemented this to chunk in stream icy metadata, so the name of the playing song shows up in the client. I would like to add playlist ...

Creating a Delay in lua

I'm making a IRC client using LUA. I'm using the the libraries that came with "Lua for Windows ". So I'm using luasocket for the comms and IUP for the UI bits. The problem I'm having is that I'm getting stuck in a loop when I read the IO. I tried the timer in IUP but that didn't seem to work. I'm was looking for a way to delay the IO r...

From a Java programming perspective, what difference does multicast make to a networking program?

My manager has asked me to assess what changes would be required to add multicast support to a socket-based TCP/IP networking program that is part of a trading system. As far as I can tell, from the perspective of a Java program, it doesn't seem to matter too much whether the program is unicast or multicast. Doesn't the Java networki...