Socket error: An existing connection was forcibly closed by the remote host

조회 수: 43 (최근 30일)
Praanesh Sambath
Praanesh Sambath 2022년 6월 10일
답변: Vidip Jain 2023년 8월 31일
I am trying to send data from unity to matlab for further processing. I am using matlab as server and unity as a client. when I run the program no data is sent from unity and i get the following error
Socket error: System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host.
I tried disabling the firewall but no effect.

답변 (1개)

Vidip Jain
Vidip Jain 2023년 8월 31일
I understand that you are trying to send data from unity to MATLAB for further processing, but the existing connection was forcibly closed by the remote host.
The error message you're encountering, "An existing connection was forcibly closed by the remote host," suggests that the connection between your Unity client and MATLAB server is being unexpectedly closed. This could be due to various reasons. Here are some steps you can take to troubleshoot and address the issue:
  1. Check MATLAB Server Configuration: Make sure that your MATLAB server is properly configured to listen for incoming connections. Verify that you're using the correct IP address and port number in your Unity client code to connect to the MATLAB server.
  2. Check Unity Client Configuration: Verify that your Unity client code is correctly configured to establish a connection with the MATLAB server. Double-check the IP address and port number to ensure they match the settings of the MATLAB server.
  3. Firewall and Security Software: Even if you've disabled the firewall, there might be other security software that's interfering with the connection. Temporarily disabling or adding exceptions for both MATLAB and Unity in your security software might help.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by