Skip to content
Advertisement

send data file to another computer with RTCPeerConnection?

how can I change the code so that the computer1 code connects to the code of computer 2(computer1 and computer2 are not the same computers but on the same network).

It works locally but not when it’s two different computers

computer 1 and computer2 code that is used for the connection is defined below

this is the code that does the networking on computer1

JavaScript

this is the part of the program that have the role to receive the request and the file data on the computer2

JavaScript

the code that I modified(main.js)

JavaScript

Thanks for helping

Advertisement

Answer

You can read about peer connections where every peer connection is handled by the RTCPeerConnection object and it defines how the peer connection is set up and how it should include the information about the ICE servers to use.
You can define the ICE servers as following:

JavaScript

or

JavaScript

or

JavaScript

Moreover, You can find the full code here or here under the folder name filetransfer .

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement