Questions tagged [tcpserver]

A tcp server uses raw tcp sockets to communicate with its client (usually without using a higher level protocol such as HTTP or IMAP).

A TCP server is a server that uses raw tcp sockets for the connection. All HTTP Servers are tcp servers in the end but usually you don't call them tcp servers because they work on a higher level protocol: HTTP.

680 questions
22
votes
3 answers

Multi Threaded TCP server in Python

I have created a simple multi threaded tcp server using python's threding module. This server creates a new thread each time a new client is connected. #!/usr/bin/env python import socket, threading class ClientThread(threading.Thread): def…
Deepal
  • 1,729
  • 5
  • 24
  • 34
20
votes
1 answer

How to share data between threads in this threaded TCPServer?

I'm working on a project which involves sending data over TCP. Using the ThreadedTCPServer I'm able to do that already. The server thread only needs to read incoming strings of data and set the value of variables. Meanwhile I need the main thread to…
David Lopez
  • 283
  • 2
  • 4
  • 8
13
votes
2 answers

SocketServer.ThreadingTCPServer - Cannot bind to address after program restart

As a follow-up to cannot-bind-to-address-after-socket-program-crashes, I was receiving this error after my program was restarted: socket.error: [Errno 98] Address already in use In this particular case, instead of using a socket directly, the…
Justin Ethier
  • 131,333
  • 52
  • 229
  • 284
10
votes
1 answer

Simple HTTP server in Ruby using TCPServer

For a school assignment, I am trying to create a simple HTTP server using Ruby and the sockets library. Right now, I can get it to respond to any connection with a simple hello: require 'socket' server = TCPServer.open 2000 puts "Listening on port…
Austin Hyde
  • 26,347
  • 28
  • 96
  • 129
10
votes
1 answer

Faster way to communicate using TcpClient?

I'm writing a client/server application in C#, and it's going great. For now, everything works and it's all pretty robust. My problem is that I run into some delays when sending packets across the connection. On the client side I'm doing…
ReturningTarzan
  • 1,068
  • 1
  • 13
  • 23
9
votes
1 answer

PowerShell TCP Server

I would like to ask you, how it is possible to handle multiple connection threads. I have implemented TCP server in the following way: $endpoint = New-Object System.Net.IPEndPoint ([System.Net.IPAddress]::Any, 8989) $listener = New-Object…
Krivers
  • 1,986
  • 2
  • 22
  • 45
9
votes
1 answer

How to add logging to a file with timestamps to a Python TCP Server for Raspberry Pi

I am kinda stuck for my project & I desperately need help. I need a simple TCP server python code that has features like logging & time stamp which I could use for my Raspberry Pi. Its for my Final Year Project. I've looked at some examples, but as…
user3128228
  • 91
  • 1
  • 1
  • 4
9
votes
1 answer

C# Socket.receive continuously receives 0 bytes and does not block in the loop

I am trying to write a simplest multithreaded TCP server in C#, which receives the data from multiple clients. Every time a new client is connected, the socket connection is established and the socket is passed as an argument to the new class…
Ashish
  • 479
  • 3
  • 7
  • 18
9
votes
1 answer

Python TPCServer rfile.read blocks

I am writing a simple SocketServer.TCPServer request handler (StreamRequestHandler) that will capture the request, along with the headers and the message body. This is for faking out an HTTP server that we can use for testing. I have no trouble…
Travis Parks
  • 8,435
  • 12
  • 52
  • 85
8
votes
1 answer

Unable to make http request to django server using twisted.web.AGENT

I have written a basic tcp server factory, server client and a service using twisted. The tcp server acts as the middleware between a django server and an another program (let's call it client program). What I want to achieve - 1.client requests…
HumptyDumptyEIZ
  • 374
  • 1
  • 6
  • 18
7
votes
2 answers

why is NON-BLOCKING sockets recommended in epoll

I'm trying to learn how to use epoll() for tcp server application, 'cause i'm expecting many connections. i tried checking samples and tutorials, they always recommend using/setting sockets that are added in epoll() to be NON-BLOCKING sockets. why?
7
votes
3 answers

Create WebSockets between a TCP server and HTTP server in node.js

I have created a TCP server using Node.js which listens to clients connections. I need to transmit data from TCP server to HTTP server again in Node.js possibly through a Websocket (socket.io). However, I do not know how to create such connection…
Ravish
  • 2,428
  • 2
  • 18
  • 24
6
votes
4 answers

Unable to access TCP Server inside a Windows Universal Application

I have a Windows Universal Application that is supposed to act as a TCP server. m_Listener = new StreamSocketListener(); m_Listener.ConnectionReceived += (s, e) => ProcessRequestAsync(e.Socket); var bind =…
JoaoSantos
  • 103
  • 1
  • 6
6
votes
4 answers

Non-Blocking error when adding timeout to python server

I am writing a simple TCP server in python, and am trying to input a timeout. My current code: import socket def connect(): HOST = '' # Symbolic name meaning the local host PORT = 5007 # Arbitrary non-privileged…
Richard
  • 15,152
  • 31
  • 85
  • 111
6
votes
1 answer

TCP server with multiple Clients

I am working on TCP server/client application. My question is: My server application starts a new thread and blocks it until connection is accepted the listenforClient method But how can I manage the connections when multiple Clients are connected…
user2853535
1
2 3
45 46