Peer to peer connection custom signaling server(tcp-socket)
See original GitHub issueI am trying to make peer to peer connection from raspbarryPi to another webserver for webcam stream, where I have to usecustom signalling server using peerjs-server https://github.com/peers/peerjs-server.
Basically I am using the code from datachannel client example https://github.com/aiortc/aiortc/tree/master/examples/datachannel-cli
The signaling server run at 192.168.1.140 and pot 7000, I confirmed signaling server is working by running html/js webrtc sample.
But when I run below code, I am getting the some error.
python3 test.py offer --signaling tcp-socket --signaling-host 192.168.1.140 --signaling-port 7000 --signaling-path /
parser = argparse.ArgumentParser(description="Data channels ping/pong")
parser.add_argument("role", choices=["offer", "answer"])
parser.add_argument("--verbose", "-v", action="count")
add_signaling_arguments(parser)
args = parser.parse_args()
if args.verbose:
logging.basicConfig(level=logging.DEBUG)
signaling = TcpSocketSignaling("192.168.1.140","7000")
pc = RTCPeerConnection()
if args.role == "offer":
coro = run_offer(pc, signaling)
else:
coro = run_answer(pc, signaling)
# run event loop
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(coro)
except KeyboardInterrupt:
pass
finally:
loop.run_until_complete(pc.close())
loop.run_until_complete(signaling.close())
Error:
channel(chat) - created by local party
Traceback (most recent call last):
File "test.py", line 119, in <module>
loop.run_until_complete(coro)
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "test.py", line 93, in run_offer
await signaling.send(pc.localDescription)
File "/home/pi/.local/lib/python3.7/site-packages/aiortc/contrib/signaling.py", line 203, in send
await self._connect(True)
File "/home/pi/.local/lib/python3.7/site-packages/aiortc/contrib/signaling.py", line 176, in _connect
client_connected, host=self._host, port=self._port
File "/usr/lib/python3.7/asyncio/streams.py", line 114, in start_server
return await loop.create_server(factory, host, port, **kwds)
File "/usr/lib/python3.7/asyncio/base_events.py", line 1378, in create_server
% (sa, err.strerror.lower())) from None
OSError: [Errno 99] error while attempting to bind on address ('192.168.1.140', 7000): cannot assign requested address
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Socket.IO P2P
Socket.IO P2P provides an easy and reliable way to setup a WebRTC connection between peers and communicate using the socket.io-protocol. Socket.
Read more >How can I make a browser to browser (peer to peer) ...
Here on Stackoverflow are several topics about P2P connections in browsers: Will HTML5 allow web apps to make peer-to-peer HTTP connections?
Read more >Socket Programming in Python (Guide)
A server-client application that functions like a full-fledged socket application, complete with its own custom header and content. By the end ...
Read more >Build the backend services needed for a WebRTC app
In other words, TURN servers need to be beefier. Peer to peer connection using a STUN server The full Monty: STUN, TURN, and...
Read more >WebRTC - Signaling
Create a list of potential candidates for a peer connection. The user or an application selects a user to make a connection with....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I resolved it by using the implementation of WebsocketSignaling: as show in here https://github.com/ryogrid/aiortc-dc/blob/c24ab64f9a7be66e22d8050fc01f376e55e6f24b/aiortcdc/contrib/signaling.py#L180
For the signaling server I have used nodejs(on my own Ubuntu server) and the code here https://www.tutorialspoint.com/webrtc/webrtc_signaling.htm.
Give the
apprtcsignaling method a try, it uses appr.tc’s public server to convey signaling between the clients.