sockets

Read from socket: Is it guaranteed to at least get x bytes?

I have a rare bug that seems to occur reading a socket. It seems, that during reading of data sometimes I get only 1-3 bytes of a data package that is bigger than this. As I learned from pipe-programming, there I always get at least 512 bytes as long as the sender provides enough data. Also my sender does at least transmit >= 4 Bytes ...

Synapse: Cannot receive data from Socket

I am using Synapse with blocking sockets and try to simply send text to the connected client. Here comes the code: var SServer: TTCPBlockSocket; SClient: TTCPBlockSocket; implementation //Create and initialize the Sockets. procedure TForm1.FormCreate(Sender: TObject); begin SClient := TTCPBlockSocket.Create; SServer := TTCPBloc...

Exchange Data between two apps across PC on LAN

I have a need of implementing two apps that will exchange data with each other. Both apps will be running on separate PCs which are part of a LAN. How we can do this in Delphi? Is there any free component which will make it easy to exchange data between apps across PCs? ...

Wait Until Event Occurs

Hey, I'm doing sockets programming. Pretty much new to it. The application is a Windows Service, in its ServiceMain() function I call CAsyncSocket's Listen() method, to listen for client connections. But after it starts listening for connections, it'll return and the ServiceMain() function will return and the service is stopped. What I...

Is WCF appropriate for implementing legacy network services?

I use the term network services to refer to things such as NNTP, IMAP, POP3... things which have a defined protocol layered on top of TCP/IP. I'm having a very difficult time figuring out how I can connect to an existing network service using a WCF client. I haven't found any examples other than ones that are basically using C#-ified s...

Single or multi-threaded with TCPListener class?

We're creating a c# app that needs to communicate with one other system via TCP/IP sockets. We expect to receive about 1-2 incoming transactions per second, each message averaging around 10k in size (text and 1 image). We'll then do some processing (could take anywhere from 100 milliseconds to 3 seconds, depending on a few variables), ...

What's Python's equivalent to Java InputStream's available method?

Java's InputStream provides a method named available which returns the number of bytes that can be read without blocking. How can I achieve this in Python? ...

Re-opening a closed NetworkStream?

Good morning, I am in need of some advice, I am using a networkStream, which is streaming from a TcpClient, all was working fine, but then I required the some functionality elsewhere, which requires the stream to be closed. I can't seem to find a way to re open the connection once it has been closed. Could anyone point me in the correct...

Please help me figure out what's wrong with this web proxy code

I want to write a web proxy for exercise, and this is the code I have so far: // returns a map that contains the port and the host def parseHostAndPort(String data) { def objMap // this has host and port as keys data.eachLine { line -> if(line =~ /^(?i)get|put|post|head|trace|delete/) { println line ...

Using SslStream with IOCP

I have written a TCP server using the Socket class's asynchronous/IOCP methods, BeginSend()/BeginRead()/etc. I would like to add SSL capability using SslStream, but from the interface it looks like Socket and SslStream are not intended to work together, in particular because I'm not using Streams at all and SslStream appears to depend o...

Communication between two separate applications

I have developed a windows service which reads data from a database, the database is populated via a ASP.net MVC application. I have a requirement to make the service re-load the data in memory by issuing a select query to the database. This re-load will be triggered by the web app. I have thought of a few ways to accomplish this e.g. R...

Link-scope IPv6 Multicast packets suddenly not routable on a MacBook Pro?

Hi all, This is a slightly obscure question, but I'm stumped and I thought maybe somebody out there might have more of a clue on the issue. My co-worker has been successfully running an in-house application that uses IPv6 multicasting on his MacBook Pro for several months, but today the Mac decided to stop routing the multicast packets...

How to transfer a binary file or any file to a remote server? - Ruby

The situation is that I'm trying to write a server script that accepts file transfers from a client. I figured out how to make and connect to and from the server using the TCP protocol. However I was wondering how do you transfer a binary file in ruby? I mean you can open a binary file, but what steps are necessary to be able to transfe...

How many Socket connections can a server handle ?

How many Socket connections can a server handle by hosting this Silverlight Chat ? I know Silverlight has a limited port range available. Is this a parameter in my ecuation ? I own a VPS. ...

TCP Framing with Binary Protocol

Hey, I'm having an issue seperating packets using a custom binary protocol. Currently the server side code looks like this. public void HandleConnection(object state) { TcpClient client = threadListener.AcceptTcpClient(); NetworkStream stream = client.GetStream(); byte[] data = new byte[4096]; wh...

How to know when network down using java socket programming

Hi I have a problem how to detect when the network goes offline. My server and client are in different computer. but connected by LAN Actually I have written tcp socket programming in java. Once both server and client are connected then if i write something and put a sleep of 10 sec then I remove my LAN cable. After 1 min I plugged my L...

How to drop/restart a client connection to a flaky socket server

I've got Java code which makes requests via sockets from a server written in C++. The communication is simply that the java code writes a line for a request and the server then writes a line in response, but sometimes it seems that the server doesn't respond, so I've implemented an ExecutorService based timeout which tries to drop and r...

Either PHP's pfsockopen or Microsoft closes connection after about one minute

Hi all! I'm making an MSN client in PHP, which makes a persistent socket connection to one of Microsoft's servers: //Connect to second server $server2 = explode(":", $xfr[3]); $socket2 = pfsockopen($server2[0], (int)$server2[1], $errno, $errstr, 999999); $_SESSION["socket"] = $server2; echo '<b>Connected to 2nd server.</b><br />'; Th...

test socket connection with Java

I'm using the following class to test if a host accepts connection from java My question is, what could be enhanced here? Thanks for the feedback EDIT I have added the optional parameter "timeout" in seconds. import java.io.IOException; import java.net.Socket; import java.net.InetSocketAddress; import java.net.SocketAddress; public...

socket problem firefox extension !!

hello guys, I have a firefox extension where for some reason(for the sake of functionality) i have to employ the use of a tcp server so that it can receive messages from my client application. I am using nsiServerSocketInterface to do it. This works fine. But the problem, comes up when FF is running and i hibernate or put my m/c to sl...