Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
socket library
#1
I am new to python socket.py and while learning this library I got a question, answer to which I coundn't find in any resource.
I know that there is a number of ways to pass binary to sent() method. For example:
socket.send(b"Hello world")
or
socket.send("Hello world".encode())
But is there a way to pass string as arguement to send() without converting it to binary?
Reply
#2
(Mar-04-2024, 03:51 PM)Kate Wrote: But is there a way to pass string as arguement to send() without converting it to binary?
As far as I know, the answer is no, but this is not a limitation. In the same way, when one writes a string in a file it is necessarily converted to binary at some point. Today's computers work with binary streams.

Also note that sockets are low level components. In many cases when programs communicate, they can use higher level libraries that use socket internally.
Kate likes this post
« We can solve any problem by introducing an extra level of indirection »
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,815 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020