Questions tagged [python-sockets]

For questions related to the sockets module in the Python standard library, or more broadly socket programming in Python.

The Python library comes with a HOWTO document for sockets programming:

Socket Programming HOWTO — Python 3.x documentation

The standard library is well-documented:

socket - Low-level networking interface

Like the title suggests, sockets are the basic facility for network connections, and on Unix, several other types of interprocess connections. Beginners who want to use a particular application-level protocol should often try to find an existing higher-level library for that instead of programming directly with sockets.

506 questions
0
votes
1 answer

Python could not receive from server after sending message over

I am currently working on my assignment and I am using python socket to connect through terminal. However, I encountered a problem where after I send my message to the server and try to receive its reply, it kind of hangs. My codes are as…
Shaoz
  • 3
  • 4
0
votes
1 answer

How to get Socket server address and port of an instant messenger?

I am using an instant messenger bot. Recently Instant messenger(palringo) has changed the connection setting, and I have no idea how to get new socket server address and port that can connect bot to the Instant Messenger. Code: sock =…
Bharat
  • 29
  • 6
0
votes
1 answer

How to do UDP multi chat server socket program using threading?

I am completely new to network and socket programming. I have tried some code; say I have 3 clients and a server c1 messages and it goes through server and reflected in c2 and c3. My problem: I don't want to see my own message (if I say "hi" it's…
onemanarmy
  • 93
  • 10
0
votes
1 answer

Connecting a Java Server with a Python Client

So here's the thing, I have a basic java server that sends back to the client what ever it receives from it. The client is written in python. I'm able to make the first connection as in the server sends the client a message confirming the…
YGouddi
  • 341
  • 2
  • 14
0
votes
2 answers

python3 can't convert bytes to object 'str' implicity

I tried to some solutions in the other questions but couldn't solve. Here is my code: #/usr/bin/env python #-*- coding: UTF-8 -*- import socket import sys ip = "192.168.0.28" port = 21 data = "hckn"*250 try: s = socket.socket(socket.AF_INET,…
hckn0
  • 137
  • 1
  • 2
  • 12
0
votes
1 answer

`member_descriptor` object is not callable on socket object

I am trying to make a web proxy that is multi threaded. I can do a single threaded one just fine but when I try to use multi-threading it throws this error every time. Traceback (most recent call last): File "malwareProxy.py", line 25, in…
J Blaz
  • 783
  • 1
  • 6
  • 26
0
votes
2 answers

python - should I dispose a socket after sending udp data?

I have a a method which listens to events, and everytime an event happens, it should send data to a socket (its udp, so I don't check if the data was received). what I have in the event_handler is this: socket = socket.socket(socket.AF_INET,…
Ofek Agmon
  • 5,040
  • 14
  • 57
  • 101
0
votes
0 answers

Python: get json data from https url using sockets

I need to get some json data using API import requests url = 'https://example.com/api/some-info/' response = requests.get(url) print(response.text) # Here is JSON needeed And everything fine, except I need to make such requests very often, and…
MaxCore
  • 2,438
  • 4
  • 25
  • 43
0
votes
1 answer

Python 3 sockets app stops sending data

I've been having a program where whenever someone hit's enter, without typing something, the program will stop taking input. #Client import socket from time import sleep import time s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host =…
0
votes
1 answer

Python client for free SOAP service using socket giving error?

This is the code that I'm trying to use: import os import socket import httplib packet='''
0
votes
3 answers

Python Sockets - how can I get the IP Address of a Socket after I bind it to an IP

From the python library 'socket' is there a method that returns the IP of the socket that got binded to it? Suppose a socket was declared and initialized like: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.connect(ip, port) And I…
Jebathon
  • 4,310
  • 14
  • 57
  • 108
0
votes
1 answer

Python stateful socket programming

I have a client-server socket python script. I want to keep the state of each connection, such that I identify whether or not the client is its first connection. I unsuccessfully wrote the following code: import socket,sys,SocketServer from…
curious
  • 1,524
  • 6
  • 21
  • 45
0
votes
1 answer

TCP client server not receiving any data from each other

I have written the following TCP client and server using python socket module. However, after I run them, no output is being given. It seems that the program is not able to come out of the while loop in the recv_all method Server: import…
0
votes
0 answers

HTTP URL sniffer using python

I'm working on the tracking the browsing urls, only outgoing packets in all OS (windows, linux, Mac) I can read the TCP packet using python sockets but unable to find the URL domain names. please guide or suggest me to achieve this.
venkat
  • 513
  • 2
  • 10
  • 16
0
votes
2 answers

Asyncio: Problems with very simple write-and-disconnect UDP client

I wanted to try out the new asyncio module from Python 3.5.1. Here's my test code: import asyncio class EchoClientProtocol: def __init__(self, message, loop): self.message = message self.loop = loop self.transport =…
Hexdigit _
  • 187
  • 1
  • 2
  • 10