Best practice for connecting to a TCP service with Play - scala

I want to connect to a locally running TCP service from a web application I'm building using the Play framework and scala.
I'm not sure how to open this connection and send commands to it, should I be writing raw socket code? Also, how should I be managing the connection? Can I just open the connection once and send commands from each web request to it? What if the connection is closed or falls over?

Not sure Pay will be of much help here, most of its modules focus on HTTP communication. You should have a look at Akka-IO though.

Related

Connect to TCP server with WebGL Unity

I have a TCP server (which I can not change/modify) running which sends data and I want it to connect to Unity WebGL build.So first of all I know it is natively not supported to connect to a TCP server in WebGL. I searched for workarounds and tried the following : Use Websockify to enable connection from the TCP server to a WebSocket. I used the NativeWebsocket Library but it would not connect to the server unfortunately. I also read about these blogs :
How to let a Unity WebGL build connect to a local python server?
https://forum.unity.com/threads/webgl-tcp-client.738419/
But they didn't really help either. Has anyone tried this or knows how to make it work (if it is even possible :) )?
Thanks in advance
Unity3D uses the .NET C# libraries, so even though Unity doesn't explicitly provide a TCP library, you can still use .NET's TCP APIs. It's worth noting that not all platforms will support this, for example, WebGL doesn't support TCP communication.
See the example in .NET documentation for help on implementation: System.Net.Sockets TcpClient
For WebGL, it is impossible to use TCP communication, so you'll have to wrap the server in some kind of HTTP/Websockets transport - you cannot leave the server as is, it will not work because the protocol cannot be communicated with for security reasons.
If you have any question as to the specifics of implementation, feel free to ask in the comments - I don't have enough information to elaborate further on your specific application

Is it possible to create a proxy server for any application?

I've been trying to create a proxy server to analyze TCP packages sent between my computer and a game server.
Now I know that you can do this kind of stuff with Wireshark, but I want to understand the logic of it and how the connections are made.
My main question is that I don't know where to start from. I have the server IP and port from Process Explorer and have the basic socket programming knowledge in python, but as I said, I don't know what to code.
Am I supposed to write a socket that hijacks the incoming TCP connection and forward it to my localhost? but then how would my client send data to server?
As you can see, I'm a bit lost, and I would be very happy if someone could put me in a correct path (what should I research?).
Thank you in advance.
I think there is a useful tools can help you: iptables and netfilter. Using this, you can hijacks the incoming TCP connection and forward it to your localhost easily.

Server side SSL socket in Visual Basic (VB6)

I have to edit an existing VB6 application that deals with Socket requests from client endpoints. What are tools (Classes/methods) that allow one to make an SSL Socket instead of a classic socket. I found out that there is a control called WinSock, but I don't know whether it is suitable for the server's tasks or not.
Any kind of help will be appreciated.
Thanks.

Is there anyway to make TCP socket keep alive when switching to other App?

I'm trying to make TCP socket keep alive in Windows Phone 8.1 using WinRT. But it don't seem no way to accomplished. I read the documents on MSDN (this) it say ControlChannelTrigger isn't supported on Windows Phone.
I'm sure there is a way to do this since Remote Desktop by Microsoft can be switched to other App and connection is still alive.
Thanks for advance.
TCP socket keep alive ... can be switched to other App and connection is still alive
I think you mix up concepts.
TCP socket keep alive is only to detect loss of connectivity to the peer.
What you see with Remote Desktop is that it maintains its own state over multiple TCP connections. But this kind of resuming has to be implemented by the application itself and in a application specific way.

Can trigger.io open a TCP socket?

Is there an easy way to open a TCP socket to connect a TCP server? Should I use socketjs, jsocket or something else?
I try to develop a cross-platform application to connect to a TCP server and pull data from it.
Thanks
No, we do not have an API for that at present. But you can use WebSockets on iOS, and libraries like socket.io which fall back to long-polling on Android.
If you email us at support#trigger.io we can advise on your specific requirements and see if it could make sense to offer a native API.
I'm the author of trigger.io-tcp, an android-only trigger.io native module that allows you to open TCP sockets for sending/receiving data.
You can use it if you need sockets only for Android or fork it and write the iOS part.