sockets

C# TCP Socket "Blocking" Property Inconsistency

I use a tcp socket in the following way: m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_socket.ReceiveTimeout = 15; The general flow is that I run the m_socket.Receive in an infinite while loop and at some point the socket becomes empty for a long period but I don't want to close it. Instead I...

Sending from the same UDP socket in multiple threads

I have multiple threads which need to send UDP packets to different IP addresses (only to send, nothing needs to be received). Can I reuse the same UDP socket in all the threads? ...

Winsock structure to store path for IPC.

In unix the sockaddr_un structure exists to hold a path. Is there some windows equivalent. I've been looking all over the place and haven't found anything. ...

What is the equivalent function in APR or APR-Util for inet_aton?

In regular unix programming, I can use inet_aton. But is there an equivalent function in the APR or apr-util project from Apache.org? ...

Objective-C NSMutableArray of sockets?

Hey guys, I want to store a couple of sockets in an ArrayList/NSMutableArray, but the sockets are of type int and NSMutableArray only accepts objects (id). Is there another data type that I can use as a container for sockets? I am not sure how many entries I will have, so I would like the data container to be like an ArrayList. Thanks!...

Shortening socket timeout using Timeout::timeout(n) does not seem to work for me

I found what I thought should work perfectly at http://stackoverflow.com/questions/517219?tab=oldest#tab-top but, it did not work for me. I have Ruby 1.9.1 installed on Windows and, when I try the example "is_port_open" test, it does not work. The socket call still takes around 20 seconds to timeout no matter what value I set for the ti...

The quintessential email listener / mini server in Java or .NET

I'm embarrased of how I'm unaware of SMTP / POP3 / IMAP protocols, as much as I thought I know HTTP and TCP/IP it apears that I took email as granted, and never had to write any piece of code that will do other than sending an email via an existing SMTP server. My task is to write an incomming email channel and I would like to hear what...

Decoding gzip (using PHP sockets)

Ok, so there is this PHP implementation of Last.FM API some guy wrote and I'm using it for a small project of mine. His implementation doesn't request gzipped data from Last.FM servers so I decided to modify his implementation to work with gzip to reduce bandwidth. I have no problem in requesting gzipped data, that works just fine and al...

Broken Pipe error

I am using write() on a opened data socket in FTP implementation to send the file out. But after writing some data it is hanging for some time; and after that it is returning with Broken pipe error. any help in this will greatly appreciated. My process reads packets from one buff and writes in to the socket. I noticed this problem with i...

Silverlight 4 sockets to local programme

Hi, I'm trying to get silverlight to communicate via sockets to a third party app running on the client machine. I can get it working if my app rus out of browser with elevated permissions. In browser without elevated permissions, it fails to connect. So I reckon my problem is with SocketClientAccessPolicyProtocol and configuring my cli...

What is the preferred way of passing data between two applications on the same system?

I have an application (A) that needs to launch another application (B). I need to pass data between the applications. I can think of two approaches. The first is to open a socket. The second is to share data via a dll. The opening socket approach is straight forward. The dll approach I have some questions? I can load plug-in d...

Scala socket cannot write to output stream

Hi, I'm new in the scala world, so excuse my trivial question. :) I just want to open a socket to a port and sand and receive messages. If I receive a HELO, I want to react with a message, but I'm not able to write to the socket in any way. I used nc to listen for incoming connections: nc -k -l 127.0.0.1 3333 When the client is conne...

Java Socks proxy connection

Socket skt; Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(proxy_address,proxy_port)); Socket server = new Socket(address, port); skt = new Socket(proxy); try { skt.setSoTimeout(5*1000); skt.connect(server.getRemoteSocketAddress()); } catch (Exception e) {} the skt socket creates a new socket with the pr...

getaddrinfo inconsistent behavior

I'm using getaddrinfo to start a local server accepting connections only on the localhost: struct addrinfo *res; struct addrinfo hints = {0}; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; getaddrinfo(NULL, portbuf, &hints, &res); This seems to work fine, giving me the IPv6 address ::1 w...

Long delay [~1s] between browser attempting to connect and Socket.Accept()

Overview of the problem: I've been playing with writing custom http server apps for a while now. I found out that when any web browser connected to my server app, there would be a 0.5-1 second "latency" (according to Google Chrome), before the request was handled [which would take milliseconds] I eventually tried to make a dummy progra...

iOS 4 VOIP app responding in the background

Hi there, I have an iPhone VOIP app that copes with multi-multi transmit and receive (ie teleconferencing) set up using BSD sockets. I would like it to be able to respond to incoming requests when it is in the background but from what I can understand of the iOS 4 docs I can only do this on an NSStream object (or CFRead/WriteStream) by...

Does iphone OS 4 support Web socket?

I am working on an investigation see how web sockets is supported in browser. Firefox nightly build : Yes. IE 9 Preview: No. Can someone help me check if it's supported on Iphone OS4? Please check it on following page: http://jimbergman.net/websocket-web-browser-test/ Thanks in advance. ...

pure python socket module

The socket module in python wraps the _socket module which is the C implementation stuff. As well, socket.socket will take a _sock parameter that must implement the _socket interface. In some regards _sock must be an actual instance of the underlying socket type from _socket since the C code does type checking (unlike pure python). Gi...

Java SocketChannel doesn't detect disconnection?

I have a socket running, using selectors. I am trying to check to see if my socket is connected to the server or not. Boolean connected = _channel.isConnected(); and it always returns true. I turned off Airport (internet connection) on my computer, and when i check to see if the socket is connected or not, it still returns true. Any i...

Reading fixed amount of bytes from socket with python asyncore

Hi, I use asyncore to communicate with remote servers using "length:message"-type protocol. Can someone recommend me a way to read exact amount of bytes from socket? I was trying to use handle_read to fill internal buffer and call my function every time, checking for size of buffer, but it looked too ugly(Check if buffer is long enough...