perl client-to-server file sending and file retrieval - perl

I'm a newbie in stackoverflow and perl IO::Socket sockets programming and I have a problem with my project. I have a TCP client and server script where the client can send file to the server. The server side creates a directory where it stores the received received files.
Is it possible for me to view and retrieve/download the files that I have sent to the server?
My professor told me that if i could add these functions he would reconsider my project.
help would be greatly appreciated. THANK YOU!

A possible approach will be to send a "string" command to the server that will trigger the server to scan the download directory for all file by using the code below
The names of the files can then be sent by the server app back through the client socket
Subsequently another string command for download can be sent to the server indicating the file path of the file your're interested in and you'll use the same process you used to send the file to the server in the first place to send it back to the client.

Related

Looking for FTPS Example - NOT the Commons.Net one

i still got the Problem, that my Java Interpreter can't handle SSL Handshake from a FTPS Client Connection. So I want to try out another FTPS Class that cann store a File on a FTP Server.
Do you know any other Examples/Classes than the Commons.Net one ?
Thank you, Louis

Maintain persistent connection with GCM using perl WWW::Google::Cloud::Messaging

I found perl has got a library WWW::Google::Cloud::Messaging. I want to maintain a single TCP connection for communicating with GCM rather than opening new connection for individual message. Is this possible using WWW::Google::Cloud::Messaging?
If you want to have a persistent connection for GCM type of messaging rather than having a connection opened everytime you make, You can make use of the libwww library. Please click on the following link to download and learn more about the installation.
Hope that Helps!!

broadcast file to subscribers

i am using pubsub protocol for subscribing and publishing content , now i want to publish a file so that it will be automatically available for the users those who have subscribed.
i have explored other protocols to transfer file like
XEP-0096: SI File Transfer
XEP-0095: Stream Initiation
XEP-0047: In-Band Bytestreams
XEP-0065: SOCKS5 Bytestreams
but all the above file transfer protocols are one to one / peer to peer file transfer.
what i am looking for is once the publisher publish the file it will be available to all the subscribers just like the normal msg we publish , so is there any way to achive this ?
Just the way whtsapp chatON and other messengers are sending multiple files to multifle contact
You could try using the pubsub message to prompt a standard file transfer between the client and the server.
This would require the creation of a component on the server that you could upload the file to and use to do the file transfers.
A better option might be to do the file transfer outside of XMPP altogether. Upload to a file server and then download from each client on receiving the message with the file info.

File Distribution via SMTP: How to do the receiving side?

I need to setup a file distribution system between different sites of a WAN. Files that are dropped into some input directories on the source machine should be distributed into a directory on each of the target machines at other sites. One of the requirements is that between certain sites the only allowed traffic is SMTP. There is already a daemon in place that covers the sending side by polling input directories and mailing all found files as attachments to configured addresses (was thought for human recipients originally).
How would you design the receiving side?
One could write a stripped down SMTP server that handles only this one case, strips attachments from incoming mails, and puts them into a local directory.
One could setup a full mail server with local delivery, poll the user’s inbox and try to extract files from there.
One could setup a full mail server with a configuration or procmail to directly extract attachments into a directory.
I don’t really like any of these proposals because they are all more involved than setting up a SSH or FTP server. Also I don’t have experience with setting up and administrating mail servers.
Do you have suggestions or experiences to share?
The target system is Linux/Unix, but if you know something platform independent I’d like to hear, too.
The most suitable way is to set up an ESB with SMTP support, like ServiceMix or Mule. Mule is more straight-forward to get started with.

How do online port checkers work?

For example http://www.utorrent.com/testport?port=12345
How does this work? Can the server side script attempt to open a socket?
There are many ways of accomplishing this through server-side scripting. As #Oded mentioned, most server-side handlers are capable of initiating socket connections on arbitrary ports, and most of those even have dedicated port-scanning packages/libraries (PHP has one in the PEAR repository, Python's 'socket' module makes this type of tasks a breeze, etc...)
Keep in mind that on shared host platforms, socket connections are typically disabled for security purposes.
Another way that is also very easy to accomplish is to use a command-line port-scanner such as nmap from your server-side script. i.e in PHP, you would do echo ``nmap -p $port $ip\
The server side script will try to open a connection on the specified port to the originating IP.
If there is no response (the attempt will timeout), this would be an indication that the port is not open.
The server can try, as #Oded said. But that doesn't ensure the receiver will respond.
Typically, something like this happens:
The URL request contains instructions about which port to access. The headers that your browser sends include information about where the request is originating from.
Before responding to the request, the server tries to open a port and checks if this is successful. It waits a while before timing out.
The webpage is rendered dynamically based on the results of this test.
The response is returned to you containing the results.
Sometimes steps (2) and (3) will be replaced with an AJAX callback, which allows the response to return sooner.