jupyter_client
jupyter_client copied to clipboard
Support ipv6 ?
Enterprise gateway support remote kernel, but remote machine may be ipv6-configured.
I found that jupyter_client‘s KernelManager and ipykernel's IPKernelApp does't support ipv6.
Specifically, zmq context is not ipv6 enabled,
context.setsockopt(zmq.IPV6, 1)
So, can we turn on this option default?
I have tested some case, and found that we can turn on this option because it support both ipv4 and ipv6.
Test Report
Environment
python = 3.7.4
pyzmq = 21.0.1
Test
pub_server.py
import zmq
import random
import sys
import time
port = "5556"
ip = sys.argv[1]
context = zmq.Context()
context.setsockopt(zmq.IPV6, 1)
socket = context.socket(zmq.PUB)
socket.bind("tcp://%s:%s" % (ip, port))
while True:
topic = random.randrange(9999, 10005)
messagedata = random.randrange(1, 215) - 80
print("%d %d" % (topic, messagedata))
socket.send(b"%d %d" % (topic, messagedata))
time.sleep(1)
sub_client.py
import sys
import zmq
port = "5556"
ip = sys.argv[1]
# Socket to talk to server
context = zmq.Context()
context.setsockopt(zmq.IPV6, 1)
socket = context.socket(zmq.SUB)
print("Collecting updates from weather server...")
socket.connect("tcp://%s:%s" % (ip, port))
# Subscribe to zipcode, default is NYC, 10001
topic_filter = "10001"
socket.setsockopt_string(zmq.SUBSCRIBE, topic_filter)
# Process 5 updates
total_value = 0
for update_nbr in range(5):
string = socket.recv()
print(string)
topic, message_data = string.split()
total_value += int(message_data)
print(topic, message_data)
print("Average message_data value for topic '%s' was %dF" % (topic_filter, total_value / update_nbr))
- server ipv6, client ipv6, works!
python pub_server.py fdbd:dc02:13:414::72
python sub_client.py fdbd:dc02:13:414::72
- server ipv6 with [], client ipv6 with [], works!
python pub_server.py [fdbd:dc02:13:414::72]
python sub_client.py [fdbd:dc02:13:414::72]
- server ipv6 with [], client ipv6, works!
python pub_server.py [fdbd:dc02:13:414::72]
python sub_client.py fdbd:dc02:13:414::72
- server ipv6 = INADDR6_ANY, client ipv6, works!
python pub_server.py ::
python sub_client.py fdbd:dc02:13:414::72
- server ipv6 = INADDR6_ANY, client ipv4, works!
python pub_server.py ::
python sub_client.py 10.144.119.72
Yes, we had tested the same and is working. Will post the POC we had done.