HELP ME ! Read Data from Telnet ( WEMOS D1mini)
good morning ALL,
newbie here , i dont know how to read data from WEMOS to unity
this is my code:
public string m_IPAdress = "192.168.182.102";
public const int kPort = 5000;
public int bytes;
private Socket m_Socket;
public byte[] bytesReceived;
public string receivedData="";
void OnGUI()
{
//if the player is NOT connected
if(Network.peerType == NetworkPeerType.Disconnected)
{
//this is temporary for input of the ip address
//find out your ip address and assign it here during gameplay
m_IPAdress = GUI.TextField(new Rect(200, 100, 100, 25), m_IPAdress);
//if the player wants to connect to a server
if(GUI.Button(new Rect(100,100,100,25), "Start Client"))
{
m_Socket=new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse(m_IPAdress);
System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint(remoteIPAddress, kPort);
m_Socket.Connect(remoteEndPoint);
}
}//end of "if the player is NOT connected"
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity Networking 1 Answer
get receive from socket wifi 0 Answers
Adapt the FirstPersonController Script to Multiplayer 0 Answers
If Statement not working properly - Comparing game objects 0 Answers