1 Replies - 6672 Views - Last Post: 02 June 2015 - 11:17 AM Rate Topic: -----

#1 Richard_Grant   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 11
  • Joined: 25-September 14

Python Socket send string

Posted 02 June 2015 - 10:56 AM

I need to send a string as a byte array over a socket.
My server is expecting the data received to be a byte array with the length of 1024.

#!/Python34/python
import socket
print("Content-Type: text/html\n")
HOST = '10.10.10.12'    # The remote host
PORT = 100             # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send(b'Oi you sent something to me')

This post has been edited by Atli: 02 June 2015 - 11:14 AM
Reason for edit:: Use [code] tags when posting code.


Is This A Good Question/Topic? 0
  • +

Replies To: Python Socket send string

#2 Richard_Grant   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 11
  • Joined: 25-September 14

Re: Python Socket send string

Posted 02 June 2015 - 11:17 AM

solved the issue, the error was on my server
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1