tcp

File Transfer returns weird characters

So I'm trying to create a simple file transfer method. It's completely working for small files (a few bytes). But if I want to transfer a file with the size of 2 kB, it returns unicode characters instead of that what's inside the file. Server: void DownloadFile(SOCKET Socket){ if(Socket == NULL){ return; } while(1)...

Proper implementation of C# TCP reconnecting client

I have to write a TCP Client that will have ability to reconnect to server. The server can be unavailable due to poor network connection quality or some maintenance issues. I'm searching for quality solutions in this area. My current solutions is following: keep connection state in ConnectionState enum {Offline, Online, Connecting} cr...

Where are socket FDs are stored?

I faced few issues while writing server application using TCP on linux system. I have few queries. Where are socket FDs are stored and what are the attributes associated with socket FDs. How the kernel differentiates between FDs like socket FDs, file Fds, Message Queue FDs Socket FDs are received as int sockFD = socket(..., ..., .....

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...

Dealing with concurrent access to an XML file using a java server

In the application Im writting the server will have information abuot the users, using a XML databse. The admin user will be able to write/read information on those files too. How can I deal with concurrent access to those files? The only way users/admin can read/write to those files is by requesting to the server(Sockets, TCP connection...

User Disconnection Detection (i.e. "Online Status") Daemon

Summary: is there a daemon that will do postbacks when a user connects/disconnects via TCP, or is it a good idea to write one? Details: There are a number of questions based around this already; but I believe that this is a different "twist" on it. We're writing a Ruby on Rails web application, and we would like to be able to tell if a...

Groovy Tcp client/server sending maps

I created a basic tcp client and server in groovy and I'm wanting to send maps from the server to the client, I'm wondering if I'm able send maps across and still being able to access the values. //TCP Server def book1 = [Title of Book: "Groovy Recipes", Author: "Scott Davis", Number of Pages: "241"] server = new ServerSocket(2000) p...

need advice for type of TCP server to cater for this type of application.

The requirement of the TCP server: receive from each client and send result back to same client (the server only do this) require to cater for 100 clients speed is an important factor, ie: even at 100 client connections, it should not be laggy. For now I have been using C# async method, but I find that I always encounter laggy at...

broken connection symmetry

From the Transmission Control Protocol Wikipedia article: For example, when an HTML file is sent from a Web server, the TCP software layer of that server divides the sequence of bytes of the file into segments and forwards them individually to the IP software layer (Internet Layer). The Internet Layer encapsulates each TCP segment i...

Tunneling through HTTP

WRITTEN IN JAVA Im creating a program that connects to a proxy and then tunneling to another server to send TCP packets, this is my code: { Socket skt = new Socket(proxy_address, proxy_port); PrintStream myOutput = new PrintStream(skt.getOutputStream()); String Request = "CONNECT " + host + ":" + 443 + " HTTP/1.0"; String host3 = "Hos...

TCP packet interception and redirection under windows

I have been trying to find some way of redirecting outbound TCP packets under windows, but so far have not been successful. Does anyone know of any software/code bit that would do something like that? I am not even sure it is possible with the windows stack. I am looking at doing something similar to what "-j REDIRECT" is to iptables. ...

How to listen to a random tcp socket in node.js

I know I can create a tcp server like that in node.js var dataServer = net.createServer(function (stream) { }); dataServer.on("listening", function() { // this data server listen to a random port // but how can I get the number of port console.log(dataServer.localPort) } dataServer.listen(0, '0.0.0.0'); But I don'...

Is a single Java thread better than multiple threading in my scenario?

Our company is running a Java application (on a single CPU Windows server) to read data from a TCP/IP socket and check for specific criteria (using regular expressions) and if a match is found, then store the data in a MySQL database. The data is huge and is read at a rate of 800 records/second and about 70% of the records will be matchi...

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....

Enable RFC 1323 opts in WinNT?

RFC1323 is not supported on winnt 4. However I have heard there is a patch that enables it (some say SP3). I have SP6 and its not enabled and there are no Tcp1323Opts parameters in tcpip service registry. Apparently it was a 3rd party hack/patch. Does anyone know if it exists? ...

How can a Node.js Socket Server know which IP or domain that the client connect to?

How can I know which IP/hostname the client connect to in node.js TCP Server? var server = net.createServer(function (stream) { // The server is behind a firewall, how can I know how the client connect to this server? console.log(stream.localAddress); }); server.listen(21, '0.0.0.0'); Thanks ...

Linux: what are means of fields in /proc/net/dev?

The Linux file /proc/net/dev reads like this: [me@host ~]$ cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed What do fields drop and errs mean? Are some errs packets ...

Why does the performance drops that much when my Erlang TCP proxy gets many concurrent requests?

For learning purposes I've written a simple TCP proxy in Erlang. It works but I experience an odd performance fall-off when I use ab (Apache Bench) to make many concurrent requests. It's not the performance fall-off per se that makes me wonder but the scale of the fall-off. The backend is nginx as a web server. My proxy sits inbetween ab...

Groovy tcp readline

I recently created a tcp server in groovy and am wondering how to get it to behave similar to telnet. For example, I run my tcp server and pull up the cmd prompt to telnet the port of the script and send it commands that its looking for. Most of the commands send back one line/word of information. However there are a few that send back ...

Is it possible to tell whether an application has disabled nagles algorithm?

Given a binary application running on linux PC. Is it possible to determine if it disables the Nagle's algorithm. One way could be to see the output in wireshark and depending on the time differences. Could you please tell me a reliable way of finding it out from the wireshark output? Is there a more direct way? Can I trace the system c...