Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 problem in socket
Hi guys i need your helps guys im new in python and i have a problem in my code here is code:
from socket import *
ip = input("ip= ")
port = input("port= ")
name = input("enter the name")
s = socket(AF_INET, SOCK_STREAM)
s.bind((ip, int(port)))
print("server chat run on port"+port)
c, addr = s.accept()
print("connected to"+str(addr))
while True:
sms = input("you> ")
data = c.recv(1024)


program work but aftter i want send something to client i see this error
Traceback (most recent call last):
File "", line 13, in <module>
TypeError: a bytes-like object is required, not 'str'
pls help me thank you all <3
reply pls
Please use Python tags (for code) and error tags (for error message), so your code will be readable for anyone who may be able to help you.
You can find help here:
Gribouillis and micseydel like this post

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  socket loop problem monamour 9 678 Nov-28-2019, 12:04 PM
Last Post: buran
  socket problem technoplusnl 2 2,480 Dec-11-2016, 07:33 PM
Last Post: technoplusnl

Forum Jump:

Users browsing this thread: 1 Guest(s)