Showing posts with label jar. Show all posts
Showing posts with label jar. Show all posts

Monday, July 1, 2013

Convert from jar to dll

Nowadays, development is very eased from community.
We can easily re-use our code between different platforms in so many ways, gaining time, money and above all... today have multiple skills is not so as useful as before.

By the way, I recently had necessity to bring some java code to .NET runtimes.
No difficulties with IKVM.NET !

If you follow these steps you can convert from JAR to DLL or even from Runnable JAR to EXE!

Wednesday, August 8, 2012

String-based Socket communication classes

I recently removed an old post called "A little framework for TCP client-server communication".

That's why I think it was not so clear and useful.
Today I propose the "engine" I used.

I used those libs for some projects like:
  • A push server for Android clients
  • A server that controls some computer's feature like volume, services, tasks, also file exchange
  • A computer's mouse controller
  • Data exchange between two different processes

I think it's very useful, scalar and powerful for simple projects.

It's basically composed by two class and two interfaces.

class Server: wraps a ServerSocket object and manages incoming client connections, and messages through an interface called OnServerEventsListener.
interface OnServerEventsListener: defines some standard events like, adding a client, receiving messages, receiving errors of Server or from Clients.
class Client: wraps a Socket object and manages a simple communication through an interface called OnClientEventsListener.
interface OnClientEventsListener: defines events like connecting, disconnecting, on receiving message, on exception generated.

Sunday, March 11, 2012

A little framework for TCP client-server communications (part2)

Here we are for the second part of this article.  I remeber to everybody that this little framework is not created for market, distrubution or diffusion. (Not even for best practices)

Let's start with some example code!

On the base of what I wrote in the first part, let' see how to create a simple server with JRR Framework.

ResponseManager server = new ResponseManager(8888); //8888 is the listening port
server.setConsoleLogEnabled(true); //enable printing log on the console
server.start(); //start listening

Wednesday, February 29, 2012

A little framework for TCP client-server communications (part1)

Hello world! I'm back from work and now it's time for requiem... :)

Today I wanna talk about a little framework written in Java for managing tcp/ip sockets connections.
Why I need a framework such this and what can I do with this framework ?

Remember that a good framework is very useful if can save you a lot of time/money on writing a lot of code. I think that JRR (Java Request Response) has a big potential and if you have to write an application,on every kind of device that supports internet, you should try it and see how it's simple to manage it all

Zooming out on features: with JRR you can:

  • Enstablish a Server that listens on a port; Provide your own implementation of handling client messages and server response. Also manages timeouts.
  • Create a Client that send requests to server, and handles response, exceptions, connection timeout and custom response timeout. 
P.S. If you don't provide your implementation, classes have their own.

Want to know more? Keep scrolling this post...

Tuesday, December 20, 2011

Interrogare un Web Service ASP.NET con Android

Abbiamo il nostro bel WS in ASMX o WCF e vogliamo renderlo raggiungibile dai nostri terminali Android senza troppe rogne? Le librerie ksoap2 ci stravengo incontro!

Scarichiamo il jar relativo qui , importiamolo nel nostro progetto e aggiungiamo le referenze nella nostra classe:

 import org.ksoap2.SoapEnvelope;  
 import org.ksoap2.serialization.SoapObject;  
 import org.ksoap2.serialization.SoapPrimitive;  
 import org.ksoap2.serialization.SoapSerializationEnvelope;  
 import org.ksoap2.transport.HttpTransportSE;  

Supponendo di avere un webservice con una pagina "Service1.asmx" la quale contiene questo metodo:

 [WebMethod]  
 public string HelloWorld(string valore)  
 {  
       return valore;  
 }