- Home /
Use sockets to send data from unity
I'm developing an unity project that needs to open a socket to the http server, and send some data to it.
I already have code in eclipse that does that, so can you please instruct me how to do this in unity. I suppose I need to call different functions to create socket and send data trough it.
Here's my code simple code in eclipse:
HOST='192.168.12.4'
PORT=21
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((HOST,PORT))
s.send('A')
It sends "A" to the server, so I would like to do the same in unity.
I would appreciate any help you can provide.
Thanks in advance.
I don't know if this will give you what you want, but I ran across UniWeb in the Asset store when I was looking around for WebSocket support for Unity.
Answer by Graham-Dunnett · Jan 17, 2013 at 11:19 AM
Use System.Net.Sockets.
Can you post the sample code please..?? I want to refer it.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091041im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is it possible to control a game with an Android phone without Unity? 1 Answer
Socket IO server 1 Answer
Problem with Video Clip Loading on Android App (NOT streaming) -360VR 0 Answers
Use Android Compass rotation in PC Game 0 Answers
Create single server for multi-platform game (pc, mobile, etc) 2 Answers