tcp

Python socket not delivering packet

Python socket not delivering packet Question: I am creating a simple messaging server and client in Python using the socket library. First I am doing some validation and a key exchange before I let the user send messages. Every once and a while I get an issue where the server will send a message and …

Total answers: 1

multithreaded tcp server python

multithreaded tcp server python Question: I am trying to create a multi-threaded TCP server in python. When a new client is accepted, it goes to a new created thread. However, when earlier clients send data, it looks like the newly created thread intercept them, so that it look like from server side that only newer …

Total answers: 1

How to send a list through TCP sockets – Python

How to send a list through TCP sockets – Python Question: I want to send a list through TCP sockets but i can’t get the exact list when receiving from the server-side . To be more specific say that i have this list: y=[0,12,6,8,3,2,10] Then, i send each item of the list like this: for …

Total answers: 2

What is "backlog" in TCP connections?

What is "backlog" in TCP connections? Question: Below, you see a python program that acts as a server listening for connection requests to port 9999: # server.py import socket import time # create a socket object serversocket = socket.socket( socket.AF_INET, socket.SOCK_STREAM) # get local machine name host = socket.gethostname() port = 9999 # bind to …

Total answers: 3

Python – Send HTTP GET string – Receive 301 Moved Permanently – What's next?

Python – Send HTTP GET string – Receive 301 Moved Permanently – What's next? Question: I’m trying to use Python 2 to send my own HTTP GET message to a web server, retrieve html text, and write it to an html file (no urllib, urllib2, httplib, requests, etc. allowed). import socket tcpSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) …

Total answers: 3

Simple Python TCP IP script but won't return data

Simple Python TCP IP script but won't return data Question: The objective of my script is simple! I just want a script that will log into my server at mysite.com:1000, run a command, bring back the result of that command and print it. You can try it for yourself: Open Putty Connect to: mysite.com Port: …

Total answers: 1

How to connect MySQL database using Python+SQLAlchemy remotely?

How to connect MySQL database using Python+SQLAlchemy remotely? Question: I am having difficulty accessing MySQL remotely. I use SSH tunnel and want to connect the database MySQL using Python+SQLALchemy. When i use MySQL-client in my console and specify “ptotocol=TCP“, then everything is fine! I use command: mysql -h localhost —protocol=TCP -u USER -p I get …

Total answers: 5

Sending a file over TCP sockets in Python

Sending a file over TCP sockets in Python Question: I’ve successfully been able to copy the file contents (image) to a new file. However when I try the same thing over TCP sockets I’m facing issues. The server loop is not exiting. The client loop exits when it reaches the EOF, however the server is …

Total answers: 6

Python Sockets Peer to Peer

Python Sockets Peer to Peer Question: I’m trying to make a simple Peer to Peer Network in Python 2.7. The problem is, I can’t seem to be able to create a connection between two machines in which they both act as a server and a client. I can get it to work when one is …

Total answers: 2

Is it possible to override the default socket options in requests?

Is it possible to override the default socket options in requests? Question: I’ve written a very simple client for a rest API using the excellent requests library for python. Everything works great util I run the client through a loadbalancer, which sanely detects idle tcp connections and kills them. I’d like for my client to …

Total answers: 5