How to connect to FTP in a Java EE compliant way? - java

According to the Java EE (EJB) spec, it is not allowed to "listen on a socket, accept connections on a socket, or use a socket for multicast".
What is the Java EE compliant way to open a FTP connection?

I'd say a Java EE compliant way to make an FTP connection is through Java EE Connector Architecture(JCA) by using the appropriate ftp adapter.
However the support for JCA is mostly left to the Application Server vendor and I am not sure about the portability your code will have.

Related

What is the difference between client-side connection and server-side connection

I am fairly new to the web development, I have been going over the release notes of the Java on different platforms like linux (oracle hotspot), AIX and hp-ux. I am actually investigating around the TLS support of each version of java on those platforms. I am coming across information(Java 8, AIX) showing the support for client-side connections and server-side connections. What I do not understand is what is the difference between them.
Does it simply mean that the client trying to connect to a server and the other is server trying to connect to a client? If that is the case why is the TLS support different for both of those connections. I would like to understand the general difference between both of them and what it has to do with the TLS support.

SSH protocol version

Currently my application is working with J2SSH and now clients wants to migrate the existing server to IBM. This new server will support only SSH protocol version 2.
I have a query whether J2SSH will support SSH protocol version 2 ?.
Is there a way to find SSH protocol version in my application, currently my application is coded in Java environment with J2SSH for SSH/SFTP channels.
The original open source version of J2SSH only supports the SSH2 protocol. If you attempt to connect to an SSH1 server it will simply fail with a connection exception.
For security reasons you should probably consider migrating your code to the open source version of J2SSH Maverick. This is a similar API from the same author (that's me btw); the difference being that the new API is maintained and current whereas J2SSH has not been maintained for some time as its last release was in 2007.

Framework for JAVA socket server application

I'm developing an Android app using a server side for computations and message handling. I need to work with push notifications, so I decided to go with Socket and ServerSocket.
For now, my server side is just a pure JAVA code that receive requests and open sockets accordingly. Is there any framework for my purpose? And how should I run my server side app on a remote server, should I create a runnable jar or is there any other way?
You can use Apache MINA, which is a socket framework with useful features like NIO, session management, SSL and other filter support.
Using a reliable framework means you spend less time writing boilerplate code.
Yes, you can create a runnable jar and create a bat/sh script to run on your server. Read this article for more information on packaging applications.

Porting java sockets client to HTML5 socket.io

I have a multi-player game that uses Java sockets, the server is a standard Java application and the client is a Java applet that runs in the web-browser.
Now since last Java's update (Java 7 update 51) all applets require code signing, so I would like to move way from the applet and rewrite the client in HTML5.
I've been looking into the socket.io and it seems quite easy, but I can't find any information on how to implement it into my server.
I would like to keep the server in Java, because it will be a lot of work to port it, so is there any libs that I could use on my server to make the communication possible between a java sockets server and a socket.io client, or what is the best approach? do I really need to port the entirely server?
Thanks.
The html5 WebSocket on which socket.io works is not equal to a "normal" C or Java socket. It implements its own protocol over TCP which includes handshakes and other stuff. To port your server you have to use a library maybe this helps you.
For more information on the WebSocket protocol see here.

How do you establish a connection to a server in Java?

I want to create an application which will connect to a file server and download a few video files. The server is a shared hosting Linux server.
I don't want code or anything like that, I just want to know whether this is possible and if so, what should I be researching. Should I be using java sockets? Or can Java sockets only connect to java based servers?
Should I be using java sockets?
Depends on the type of server you connect to. You can use an existing library which will abstract the interaction with the server for you (recommended) or implement the required protocol yourself (not recommended).
Can Java sockets only connect to java based servers?
Sockets in Java are just an interface to the native socket API of the OS you are on. Every program that connects to a server over the network has to use them, regardless of whether it is a C/C++/Python/Java/... application. So, to answer your question; no, "Java sockets" can connect to any server.
Read more about sockets in this Wikipedia article about sockets in general or this one about Berkeley sockets (the socket API implemented by most operating systems).

Categories