File: test.py

package info (click to toggle)
sabctools 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,000 kB
  • sloc: cpp: 13,977; sh: 1,112; python: 950; ansic: 191; makefile: 13
file content (22 lines) | stat: -rw-r--r-- 550 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import time
import ssl
import sabctools
import socket
import time


hostname = "eunews.frugalusenet.com"
context = ssl.create_default_context()

print(sabctools.openssl_linked)

buffer = bytearray(100)
bufferview = memoryview(buffer)

with socket.create_connection((hostname, 563)) as sock:
    with context.wrap_socket(sock, server_hostname=hostname) as ssock:
        ssock.setblocking(False)
        time.sleep(1)
        print(ssock.version())
        print(sabctools.unlocked_ssl_recv_into(ssock._sslobj, bufferview[99:]))
        print(buffer)