English 中文(简体)
Does PLayN work with sockets?
原标题:

I have a java application that uses sockets to connect to it s server. I want to wrap it with PlayN but i can t find out the way to make sockets work if there is one at all. There IS the way, isn t it?

问题回答

PlayN applications can be compiled to JavaScript and run in the browser. There are no browser APIs for reading and writing sockets directly. There is a WebSockets API, which is presently very primitive, but at least accomplishes asynchronous message passing between client and server over a persistent connection.

You will not be able to "wrap" an application that uses plain Java sockets. You can create an abstraction layer for your network and route the socket communications over WebSockets, but that s the best you can do if you want the game to run using the HTML5 backend.

If you are not interrested in HTML as backend but only platforms that do support sockets in one way or another you could create an abstraction for your network communication in the core project and implement it with the different platform specific sockets in each platform specific project. In HTML you are out of luck unless you can settle with web sockets.





相关问题
Max Outgoing Socket Connections in .NET/Windows Server

I have a slightly unusual situation where I m needing to maintain CLIENT tcp connections to another server for thousands of mobile users on my servers (basically the mobile devices connect to my ...

Determine the remaining TTL of a multicast packet in Java

If I have a Java program that listens to multicast data, how can I tell what the remaining TTL of the incoming datagram is? I know how to set the TTL on the sending multicast socket, but I want to ...

Python socket not receiving anything

I m trying to receive a variable length stream from a camera with python, but get weird behaviour. This is Python 2.6.4 (r264:75706) on linux(Ubuntu 9.10) The message is supposed to come with a ...

Connecting to a Source game server in VB.NET

I m developing an application that detects Source-based games running on the LAN. Following up on the specifications provided by Valve, I have it narrowed down to exactly what I want: making a UDP ...

What can cause select to block in Python?

Here s a snippet of code I m using in a loop: while True: print loop rlist, wlist, xlist = select.select(readers, [], [], TIMEOUT) print selected # do stuff At a certain point, ...

Socket.UseOnlyOverlappedIO?

Does anyone know what Socket.UseOnlyOverlappedIO does, and if so, does it affect performance? There seems to be no real explanation on MSDN. Thanks in advance.

热门标签