rablentain
rablentain

Reputation: 6715

Java client and Erlang server?

I am about to write a client-server application (a simple game) and I want to use Erlang for the server side and Java for the client side. How should I make the connection between client and server? I have never worked with network programming before...

I think that "sockets" is the thing that I should use, am I right? In that case, could I use Java's sockets-class to send/recieve messages on the client and some corresponding sockets-module in Erlang on the server? Or do I have to have some kind of Java receiver on the server and then translate to Erlang? Is sockets some general protocol sent over the network that all languages interprets?

Upvotes: 4

Views: 774

Answers (3)

nablaone
nablaone

Reputation: 26

Depends on what you want to learn.

  1. Sockets are low level and you will need design a protocol.
  2. HTTP Rest API is more general, requires web server (yaws for example)
  3. or Jinterface Erlang<->Java bridge

http://www.slideshare.net/dennisbyrne/integrating-java-and-erlang-with-jinterface-presentation

Upvotes: 1

Alexey Romanov
Alexey Romanov

Reputation: 170745

Another alternative to sockets and HTTP for creating

some general protocol sent over the network that all languages interprets

is something like Apache Thrift or other interface description languages (IDL). While it doesn't support all languages, it does support both Java and Erlang.

Upvotes: 0

Chiron
Chiron

Reputation: 20245

Indeed, Erlang provides a module for Socket programming that you can use. Go with your option number one.

But is such low level programming is a must for you? If not for your game, then consider creating a REST API. It is HTTP after all. Thus you can achieve:

general protocol sent over the network that all languages interprets

Upvotes: 1

Related Questions