I am learning how websocket works in python 3. I add print(sock) to def handshake of _handshake.py in websocket source to learn what is the message inside sock And the result is sth like this:
Print out sock:<ssl.SSLSocket fd=508, family=AddressFamily.AF_INET, type=0, proto=0, laddr=('192.168.1.2', 58730), raddr=('202.160.125.211', 443)>
I wonder what laddr and raddr is? I know that is too basic but without solid background as me it appears complicated to understand I have searched gg for those keywords but there is no explaination.
def handshake(sock, hostname, port, resource, **options):
headers, key = _get_handshake_headers(resource, hostname, port, options)
header_str = "\r\n".join(headers)
send(sock, header_str)
dump("request header", header_str)
print("Print out sock:{}".format(sock))
status, resp = _get_resp_headers(sock)
if status in SUPPORTED_REDIRECT_STATUSES:
return handshake_response(status, resp, None)
success, subproto = _validate(resp, key, options.get("subprotocols"))
if not success:
raise WebSocketException("Invalid WebSocket Header")
return handshake_response(status, resp, subproto)