I succeeded setup a Java TCP server.
I succeeded setup a PHP TCP client. (By using stream_get_contents, fwrite)
The problem is, when I try to transfer my PHP TCP client to a hosting company (in my case GoDaddy.com), it doesn't work. GoDaddy probably blocks stream_get_contents.
What are my alternatives?
did you try your code locally? if it works locally maybe you should try these:
-fix firewall issue on JAVA tcp server machine
-check for NAT/PAT configuration
and if it still doesn't work,
I don't think you can communicate with other servers at socket level on hosting environments(not sure). but why don't you use web services?
Related
I would like to connect with an SFTP client to an FTP server using java. I know the two technologies have nothing to do with each-other. What I'm trying to accomplish is to connect to an FTP server via the internet with out using two ports or changing the server configuration.
Is there any SFTP->FTP bridge in java it would be great. If not, how can I accomplish that ?
I would like to incorporate this in an exciting java server so hence, java based solutions are preferred. If there is some standalone software which you can control via code than it should support windows and *nix.
(Since SFTP is just the means here, a similar WebDav solution will also work)
You could go with trial and error. Try this out see if it works.
How to retrieve a file from a server via SFTP?
I'm running a server-side application on a remote server, using a particular port - call this port 9000. Using a separate laptop, I've been able to telnet to a simple Java hello world TCP server and to access a HTTP server through my browser. These listened to port 9000 and were made using the standard Java libraries and com.sun.net.httpserver. However, when I use Node.js to create an application (i.e. server.listen(9000, 0.0.0.0)), I cannot connect to that application.
Is there something additional I should do to create a successfully listening HTTP server using Node.js? Any additional dependencies? As per above, assume there are no firewall issues between my laptop and my server.
For a larger context, the program I'm trying to run is etherpad-lite, which uses Node.js to create a server.
Don't include the IP address of 0.0.0.0.
This is telling the server to only listen to requests to that 'hostname'.
Just use
server.listen(9000);
Thrift provides several different non-blocking server models, like TNonblockingServer, THsHaServer, and TThreadedSelectorServer. But, I'd like to enable SSL on the server. It seems SSL only works on blocking servers in Thrift.
Anyone has any clues of a non-blocking SSL server in Thrift? Java example would be highly appreciated.
One alternative to worrying about SSL in your Java App is to stand up something like nginx (http://wiki.nginx.org/SSL-Offloader) as a reverse proxy.
This has the upside of your application not needing to care about SSL but does require one more layer in your stack.
Clients will connect to the nginx server instead of directly to your client and nginx will forward those connections to your Thrift server.
You don't necessarily need two different servers for this approach, just configure your Thrift server to only listen on localhost (127.0.0.1 for ipv4) and have nginx listen on your external interfaces and forward to localhost.
Edit: client -> server in last paragraph
OK, I'm new to server-client applications, and i need some basic information, so forgive me if my question is not clear...
I want to make a chat application that would function like this:
Client A sends information to server, server sends the same information to client B, and vice versa... Think of it as of a simple chat program.
All communication is done through sockets, so i would have a server socket application, and a client socket application... I want my client application to be on my PCs and server application to be on a remote server ( it would be hosted on some free hosting websites).
My question is how do I start that server application on that remote server?
Thanks in advance!
If you are just trying to make a chat client, I don't think you would need an intermediate server. Just connect two machines using server and client sockets
SERVER:
ServerSocketChannel serverSocket;
serverSocket = ServerSocketChannel.open();
serverSocket.socket().bind()
serverSocket.socket().accept()
CLIENT:
SocketChannel clientSocket = SocketChannel.open();
clientSocket.connect();
Of course you would have to use the bind and connect functions properly. Read up on their API's
The remote server can be started manually. (If you do not have access to remote server or if you are hosting your server on some third party infrastructure, then they might have a way to do it.)
To be able to start it remotely via some program, you again need a server on the remote machine that listens to this kind of requests.
Usually, you want an application that is running all the time at your hosting provider (like a web server or perhaps inetd) to start (or embed) your application. The details will be determined by what your hosting provider provides.
If you're using plain sockets, you should look for some remote server with SSH login. You're able to start your application on the shell then, sth like:
java -jar yourapp.jar
Free hosting websites are rather targeting customers that want to host their website. In my opinion that is not the best choice for hosting a socket application.
For developing purposes, I'd stick with the local machine for the beginning. Running/testing server/client connections on the same machine is much easier as you don't have to work on two different machines, copy code, etc.
This tutorial is relatively short, but fully covers basics of Java networking. And it is right about simple chat.
I'm trying to set up an Apache Mina FTP server in my continuously-deployed Java application. I'd like to be able to update and deploy it without users experiencing FTP downtime. I suspect this involves some sort of proxy (ProxyConnector?) to handle requests and delegate them between two copies of my FTP server. When a change is made, one copy should be updated and restarted before the other in order to maintain uptime.
I haven't been able to find any examples of this with Apache's Mina FTP server. Is this possible? Where can I find examples? Thanks.
You need a standard proxy server which listens to the two FTP ports and passes the connection to one of two FTP servers, you could even implement fail over or load balancing the proxy. The simplest TCP proxy just copies what ever it gets from one socket to the other in both directions.
The code is the same, regardless of what TCP server you are proxying or what software it uses.