try:
    import usocket as _socket
except:
    import _socket


s = _socket.socket()

ai = _socket.getaddrinfo("google.com", 80)
print("Address infos:", ai)
addr = ai[0][4]

print("Connect address:", addr)
s.connect(addr)

if 0:
    # MicroPython rawsocket module supports file interface directly
    s.write("GET / HTTP/1.0\n\n")
    print(s.readall())
else:
    s.send(b"GET / HTTP/1.0\n\n")
    print(s.recv(4096))

@@ -20,17 +20,16 @@
 cket as 
-_
 socket%0Ae
@@ -46,17 +46,16 @@
  import 
-_
 socket%0A%0A
@@ -59,17 +59,16 @@
 t%0A%0A%0As = 
-_
 socket.s
@@ -85,9 +85,8 @@
 i = 
-_
 sock
@@ -240,32 +240,30 @@
 hon 
-raw
 socket 
-module
+objects
  support
 s fi
@@ -262,14 +262,26 @@
 port
-s
+ stream (aka
  file
+)
  int
@@ -286,16 +286,22 @@
 nterface
+%0A    #
  directl
@@ -301,16 +301,88 @@
 directly
+, but the line below is needed for CPython.%0A    s = s.makefile(%22rwb%22, 0)
 %0A    s.w
@@ -386,16 +386,17 @@
 s.write(
+b
 %22GET / H

Improve CPython compatibility in stream mode.