Friday, March 19, 2010

Send and Receive files from remote system

Send and receive files from java socket programing

Sender :

1. Create a Scoket connection

ServerSocket servsock = new ServerSocket(13267);

2. Checks for the socket acceptence from socket client

Socket sock = servsock.accept();

3. Stream the file and output the stream


Receiver :

1. Create socket with sender ip address and port

Socket sock = new Socket("192.168.2.22",13267);

2. Get the stream from the socket .

InputStream is = sock.getInputStream();

 Source Code

Related Posts:

  • WebServiceClient test codeFollowing is the sample test code to test the webservice import javax.xml.rpc.Call; import javax.xml.rpc.Service; import javax.xml.namespace.QName; public class TestClient {   public static void main(String [] args) { … Read More
  • Universal sql file executorNeed to execute the sql files without client installation on the box download sqlsexecutor installer which will execute any sql file of database type Mysql,Oracle,Sybase and Mssql. download link https://sourceforge.net/pro… Read More
  • MySql DB commandsfor mysql : create database test; grant all on test.* to test@'localhost' identified by 'test'; grant all on test.* to test@'%' identified by 'test'; to run scripts in mysql mysql> source <path to sql file> MySql… Read More
  • Coherenc samples and clustering with help of oracle coherence tutorialsAll below explanation and samples are done by reading the document provided by the oracle coherence. The simplest and most flexible way to create caches in Coherence is to use the cache configuration descriptor to define att… Read More
  • Send and Receive files from remote systemSend and receive files from java socket programing Sender : 1. Create a Scoket connection ServerSocket servsock = new ServerSocket(13267); 2. Checks for the socket acceptence from socket client Socket sock = servsock.acc… Read More

1 comment:

  1. hey buddy great work.
    i can't reach your source code. i think it is deleted or something, can you please upload the source code.
    thank you

    ReplyDelete