0

How can I open a tcp connection with javascript, send data and close the connection synchronously?

I am looking for something like this

   var connection = new tcpconnectio();
   connection.open(ip, port)
   connection.send(data)
   connection.close

But synchronously , any suggestions?

Ivane Gkomarteli
  • 133
  • 3
  • 18
  • See [Method for streaming data from browser to server via HTTP](http://stackoverflow.com/questions/35899536/method-for-streaming-data-from-browser-to-server-via-http/37903033?s=1|4.1486#37903033) – guest271314 Apr 29 '17 at 17:59
  • is this node or a browser? – nycynik Apr 29 '17 at 18:27

1 Answers1

0

i am new to the forum and going to give this a shot. I dont believe its possible to send data if the port is closed at the same time. You could venture for closing it the second that the data reaches the file size amount.

aka- if the data file is 100kb you could make a data = download amount datamax = 100kb

do {connection.open} while (data != datamax)

anyways just a thought. ill look up more online and see if i can find something. good luck!