sockets

Python socket client-server application

I wrote two applictions which comunicate by socket. This is the code: Server: import socket server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.bind(("",9999)) server_socket.listen(5) video = True power = True print "TCPServer Waiting for client on port 9999" while 1: client_socket,address = server_s...

Opening a Socket.IO connection in a google chrome extension

Hi there, I'm trying to figure out how to open a connection to an external Socket.IO server every time the user visits a new page from a google chrome extension. This is my first extension, so it's a bit tough. I tried using an iframe and the history.onVisit event, but no luck so far. ...

network topology

Hi, I'm trying to build an application that would display network topology, using c or maybe c++. I have knowledge of sockets. I know this a broad question with little details. It's just that i haven't found anything to start from. I have no idea what to do. ...

Why lsof shows odd sockets?

I am opening a unix domain socket on file system. lsof give me this as the output. proxyShel 27379 root 0u unix 0xe8250200 0t0 26605515 /var/lib/dsock proxyShel 27379 root 2u unix 0xe74e4600 0t0 26606355 socket Well, "dsock" is the socket I am listening to, but what does the second entry mean? :s ...

File decriptors and socket connections..

I am trying to understand how are file descriptors related to sockets. As per my understanding, you listen on a particular file descriptor, once a connection comes in , you accept it , which returns you another file descriptor ( 2 in all ) and you use this 2nd descriptor to send/recv data. The strange behaviour i am observing is that a...

c++ boost asio timeout for blocking connect

I have a C++ boost client that does a blocking connect and processes the message once it receives a response. I am facing a strange issue. tcp::resolver::query query(tcp::v6(), this->host, port,tcp::resolver::query::v4_mapped); iterator = resolver.resolve(query); socket = new tcp::socket(io_service); socket->connect(*iterator); I tri...

HTML5 Web socket Handshaking

I'm sort of new to web programming, but I wanted to write a HTML interface for a embedded device (coded in C) that I am developing. I've already implemented a stream server (a la beej's socket server example) and a java client, but I'm interested in implementing a HTML5 Socket interface instead. I am having some trouble with the handsh...

Socket.SendAsync does not detect dead TCP connection

Hi, I'm having an issue with the Socket.SendAsync method not detecting a dead TCP connection. In my client/server app, the server is sending heartbeats to connected clients in regular intervals. The issue that I'm experiencing is that even though the client might be dead, the callbacks from the SendAsync method indicate "SocketError....

Avoiding socket timeouts in SQLAlchemy

I'm new to SQLAlchemy, but I'm trying to use it to create and fill a database for a personal project. I've set pool_timeout to 43200 (twelve hours), but I'm still getting socket timeouts. engine = sqlalchemy.create_engine( 'postgresql+pg8000://gdwatson:pass@localhost/dbname', pool_timeout=43200) db.tables.meta.d...

Can you write to a socket from disk without loading the data in question into memory first?

Using the Socket API in AIR to write a large file to a server, is there a way to do this without reading the file into application memory first? I am using FileStream to store the data in a bytearray and then writing that bytearray to the server through the socket but can I just have something like a file descriptor that references that ...

WSAEINVAL error from WSASocket on socket duplication

Hi. I'm trying to transfer socket from the one process to the another process constantly. I'm using WSADuplicateSocket on the master process which always works fine. Then I'm calling WSASocket on the child process. However, I do get WSAEINVAL error from WSASocket once in a while. I check lpWsaProtocolInfo parameter and it's always good....

C# socket read error

In my program i'm creating socket and whes client connects i'm creating new thread and trying to read and write from/to connected to this socket, but alway get an Read Error because host-computer closed connection for the second command, first command from client worfs fine, and third works fine. i try to check if clientSocket is connect...

Socket programming at low level

Hi, I am unable to understand or grasp rather; what it means to program at a lower layer in socket programming. I am used to working with tcp/udp/file system sockets. These are all wrapped around their own protocol specifications ... which as i understand would make it working at the application layer in the stack. In the project i am ...

IO multiplexing in Linux

Is there something like the sendfile-syscall that works with multiple target file descriptors (i.e. instead of copying from one FD to another FD, it could should copy to, say, 4 FDs)? I know that when talking about asynchronous IO, this is known as gather/scatter, but I could not find anything in the Linux AIO documentation. ...

Example socket programming in iphone

I am learning objective C.I like to know about client/server(socket) programming for iphone. I went through many answers,but still having many confusion with that flow and working.Can anyone help me out with code. Thank U!! ...

How to set a timeout in connect/send ? ( as400 iseries v5r4, rpg )

From this rpg socket tutorial we created a socket client in rpg that calls a java server socket The problem is that connect()/send() operations blocks and we have a requirement that if the connect/send couldn't be done in a matter of a second per say, we have to just log it and finish. If I set the socket to non-blocking mode (I think...

php socket http post not working

I'm trying to write a php script to send a http post request to a url. It doesnt seem to pass through for the server is not receiving it. Can anyone help? <?php function postXMLToURL ($server, $path, $xmlDocument) { $xmlSource = $xmlDocument; $contentLength = strlen($xmlSource); //$fp = fsockopen($server, 80); $fp = ...

How do I receive raw, layer 2 packets in C/C++?

How do I receive layer 2 packets in POSIXy C++? The packets only have src and dst MAC address, type/length, and custom formatted data. They're not TCP or UDP or IP or IGMP or ARP or whatever - they're a home-brewed format given unto me by the Hardware guys. My socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW) never returns from its recvfrom(). ...

high compress Image

Hello, I'm trying to do a "remote desktop viewer". For this I need to send the user's desktop - and it's alot of infomation for sockets...(especially if the resolution is high and the information can approach to 5.3MB (1680X1050)) So I started to compress with GZIP stream and the 5.3MB became 500KB, then I added my own compress algorith...

Problem with Flex socket and Java server

Hi every one, I am writing a online game with flex and java server and I have a big problem. In normal case, my game run smoothly but some time the clients can't receive the command from server. I found that if server send message too fast or client is doing something when server send message, the game client can't detect for a new mes...