sockets

TCP/Sockets in php, holds up my thread?

I need to have my PHP application (its a stand alone, not web-based) connect to a server, and also host a tcp socket for things to connect to it.. but since php isnt multi-threaded, i cant have the server listen on one socket, and host another at the same time! it all has to be in one file. is it possible to run both of these side by sid...

Blocking recv doesn't exit when closing socket from another thread?

In Linux if we call blocking recv from one thread and close for the same socket from another thread, recv doesn't exit. Why? ...

How do I use Python socket ports and make sure that windows won't block them (like ipmsg.exe for example)? (involving maya)

Hi, I am trying to create a Maya to Maya interface using Python so I could possibly make a game from within Maya that runs on two different computer. I have successfully written ways to send commands from one Maya to another using the command "commandPort." The problem is when I start sending commands from another computer, it fails.I g...

What is the IPv6 alternative to socket.getfqdn in Python?

socket.getfqdn() works fine with IPv4 addresses, for example: >>> import socket >>> socket.getfqdn("8.8.8.8") 'google-public-dns-a.google.com' However, it doesn't work for IPv6 addresses. >>> socket.getfqdn("2404:6800:8004::68") '2404:6800:8004::68' >>> socket.has_ipv6 True How can I do this with IPv6? Ideally with only modules in...

Java socket problems half closing

I'm using JDK 1.3 (BD-J platform) using tcp sockets. I seem to be getting some errors half closing on the client end. If I'm done writing and close the lower socket output stream, I seem to get an exception trying to read from the server end (most messages go through if it's not closed), but when it's closed I run into troubles. Attemp...

C#: UDP Listener Thread

Hi, i found articles to that topic, but they dont solve my problem... I want to use UDP-Sockets for my XNA-Networkgame. And now i am trying to code a reliable Listenerthread, but there are some Problems. If i use socket.Receive it will wait until a packet. This is fine for my Listenerthread. My thread has a while-loop like this: while...

C# TcpListener and PHP socket/tcp client not communicating.

Alright so i have the tcp listener, and when i recieve a tcp client i pass it to a class which uses the Streadread/writers to communicate: EDIT::: I forgot to mention that, they connect to each other fine, but just wont read/write to eachother.. C# side: private StreamReader srReceiver; private StreamWriter swSender; pri...

Asynchronous socket, forced disconnection and reuse

Im writing an application which is going to act as a tcp listener for a single client. The client is a java applet and will periodically connect to the listener, send some data and then wait for a response. The code for the TcpServer class below has been largely lifted from an example provided by a more knowledgeable stackoverflow membe...

.NET Async TcpListener / TcpClient Question...

I'm at a bit of a loss as to how to properly implement the asynchronous methods for TcpListner and TcpClient int .NET. I've read over quite a few posts on hear and I believe I have the code to accept new clients on the server taken care of. Here is the code for acception new connections: Public Sub Start() m_oListener = New TcpLis...

.Net Socket Server Page Faults

I have a vb.net asynchronous socket server/listner service that is showing extremely high "Page Faults" in the task manager. Can I please have some feedback as to what this implies and how do I go about resolving the issue? Thanks for all feedback. ...

Simulate Socket Hard Disconnect

I have a C# app where a server and some clients communicate from different machines using sockets. Most of the time, the server detects a dis-connect correctly when it receives 0 bytes in the sock.Receive(...) call. But when there is a hardware issue (say a network cable is unplugged), there is a problem. One server thread continues t...

PDO: Connecting to different machine, 'Can't connect through socket' Error

I'm trying to connect to a different machine: $this->_connection = new PDO("mysql: host=MYSQL_SERVER; dbname=MYSQL_DATABASE",MYSQL_USER, MYSQL_PASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); But PDO barfs: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) ...

Removing SOCKS 4/5 proxy

This question is sort of the opposite of this: http://stackoverflow.com/questions/2317849/how-can-i-use-a-socks-4-5-proxy-with-urllib2 Let's say I use a SOCKS 5 proxy using the method accepted in that question. How would I revert it back to no proxy in the same process? i.e start process use proxy .. remove proxy ... Maybe there is ...

SSL_Connection failed with SSL_ERROR_SYSCALL with errno=2?

SSL_Connect API is failing with return value 5 errno=2. can any one help me in how to trace the same? can any one let me know what could cause this issue? OS: Windows 2003 Std Sp2 32 bit ...

Strategy for TCP star network peer connections

The networking application that I've written does TCP communication with N-1 (itself) other Machines in the List (N) of Machines participating in the system. Upon application startup the application currently picks a Random Delay time (1000-3000ms) before attempting to connect to each of its peer systems If Machine 1 attempts to Connec...

Do TCP connections get moved to another port after they are opened?

If a TCP socket server listens on port 28081 for incoming connections and then accepts a connection and start receiving data. Is the port that data is coming into still 28081 or does the port get changed. for example what port does the incoming data come to in the pseudo code below? Is it still 28081 or does the OS assign a new port?:...

How to connect to gtalk in java?

Hi, i am trying to code a small XMPP gtalk client in java. I know there is a lot of libraries that help you that but the RFC is so easy to understand that i decide to write a client by myself. I know that the gtalk server is talk.google.com:5222 but when i try this small program i get this result : HTTP/1.1 302 Found Location: http://...

How to unit-test an internet protocol implementation?

I decided to add unit tests to my project and continue development in a test-driven kind of way. I’m currently working on implementing unit tests for my ManageSieve client object and I’m not sure what’s the best way to test that beast. My SieveClient object relies on two other objects for the network communication: CocoaAsyncSocket and ...

Connect to multiple clients asynchronously

I'm trying to write a programme to connect to a list of a dozen or so clients asynchronously using VB.NET. I'm a newb to sockets and I'm having next to no luck. More of the latter to be precise. Using this MSDN article, I would like to connect to the clients and store them in a List or Dictionary. I don't suppose anyone could help? Tha...

Problem in socket_connect() function

// Create a new socket $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); // An example list of IP addresses owned by the computer $sourceips['kevin'] = '127.0.0.1'; $sourceips['madcoder'] = '127.0.0.2'; // Bind the source address socket_bind($sock, $sourceips['madcoder']); // Connect to destination address socket_connect($sock,...