Send file sequentially with BPM

Dear,
in my scenario that I'm developing I need to read txt files and send them to SAP ECC through Abap Proxy. I need to send file by file to SAP ECC sequentially. That is, I need to read the file "file1.txt" and send to SAP, then read the file "file2.txt" and send it to the ECC and so on.
How can I do this?
You can use BPM?
What are the steps to implement the BPM?
Regards,
Sérgio Salomã

Hi sergio
Just for this functionality no need to  use BPM , it will degrade performance
rather you can use simple file adapter with quqlity of service EOIO. for EOIO it will use seperate queue and files will be in oredr
thanks
sandeep

Similar Messages

  • Sender File Adapter with file conversion

    Hi guys,
    I’m using a Sender File adapter with file conversion. The message to be processed has a structure with fixed lengths and in your content are some values that needs to be ignored.
    An example:
    value1  <b>value2</b>  value3…
    I want to ignore <b>value 2</b> but I can’t find a parameter for that! Do I need to define dummy fields on my data type and ignore those fields during mapping? Or there is a specific parameter for that?
    Thanks in advance,
    Ricardo.

    hi,
    there always is another way:)
    you can import the whole line to one field
    and cut it inside the adapter module
    (then you can define start and stop of the substring that you need to use)
    but of course it's not standard even though it's quite easy to achieve in java
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • How to design the scenario? i have process files sequentially with timegap

    Hi Folks,
    I am really looking for one requirement like, Sender file adapter has to pick multiple files by file name based with some time gap? Can we?normally i am getting 40 files in the source directory with some time gap like 1hr and 2 hours.but my in some situations like system got down and if the server stopped for some refresh work then 2 days files will come to source directory and after system is sap pi try to process files at a time but the source side can,t process more than 4 files at a time
    in tht case the messages are not processed they are in schedule mode only.
    I have got one BPM in this, I have tried with Process mode : Name and Date, with wait step on BPM, but no use. The way how PI behaving, if 40 files in file directory, it is picking all files in one shot. Start processing but not in order. if it is process also the SNC system can't process 4 at time.it will process files with some time gap.
    The problem is on Receiver system side. The receiver system is SNC system, if old data receives later than earlier date data; we get data obsolete application error.
    Ex: If I receive 25th and 26th files, first I need to process 25th first on PI sends to SNC, I need to give some time gap and pick another file or even PI picks and process 26th file, no problem but I need to give some time gap to send SNC to this 26th date file?
    Please how guys, throw me your great ideas
    Thanks in advance!!
    Regards
    SG

    Hi Seshagiri,
    first problem is to process the files sequentially by XI- Is it posiible to put a sequence number at end of each file as its last line? This number you can process within XI and hold on messages in a container unless all files with lower sequence number has already been processed thus you can also prevent receiver SNC system to receive files out of order. The sequence number has to be put before posting the file in XI.
    regards
    Anupam
    Edited by: anupamsap on Nov 25, 2010 7:48 AM

  • Problem in FILE to FILE scanariao with BPM

    Hi all,
    Please give me the advise regarding scanario File to File with BPM. When i was sending the message from source to target its not getting. The message can be taken from sorce file, but in recieving side i did't getting.
    I checked both adpters, in send adapter get the message, but the reciaver adapter not getting message. Please give me solution any one.
    Thanks & Regards
    Gangi Reddy.P
    SAIC_INDIA
    Bangalore

    hi,
    check this doc:
    https://websmp110.sap-ag.de/~sapdownload/011000358700003141152005E/HowToMonitorccBPM.pdf
    maybe it's stuck in the BPM
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Sender file adapter with content conversion  Simple XML

    Hi experts,
    I'm trying to parametrize my sender file adapter content conversion.
    I'm receiving a text file with one single line like:
    AA1;AA2; AA3;
    and I want to convert it to an XML like
    <MT_A1>
    <field1>AA1</field1>
    <field2>AA2</field2>
    <field3>AA3</field3>
    </MT_A1>
    Actually I know how to do somenthing like
    <MT_A1>
        <LINE>
              <field1>AA1</field1>
              <field2>AA2</field2>
              <field3>AA3</field3>
         <LINE>
    </MT_A1>
    What I want is remove the <LINE> tag from my XML.
    Regards
    Gonzalo
    Edited by: Gonzalo del Castillo on Nov 28, 2008 2:18 PM

    Hi
    Use this help document for receiver FCC
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
    Content Conversion (Pattern/Random content in input file)
    File conversion text to xml (Few Last Post)

  • Sender File adapter with nested structure

    friends,
    Source structure is looks like below
    <mt_details>
    <header>
       <key> </key>
       <id > </id>
       <name> </name>
       <contact>    
          <key> </key>
          <pno> </pno>
       </contact>
    </header>
    </mt_details>
    If both the nodes i.e <header>&<contact> are at same level then the sender adapter picking the file as requried.But in this case the <contact> node is subnode of <header> Please help how in configuring the sender file adpter(Fixed file).
    Sample file :
    HDRE100testname
    PHO999999999
    Ravi Pal

    Hi Ravi,
    I dont think this is possible, Just read the following link,
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    and the content under FILE STRUCUTRE says,
    <i>The structure of these substructures must be fixed and corresponds to the description of the row structure logic in the table below.</i>
    The strcuture that you want is not supported.
    Regards,
    Bhavesh

  • Soap to File Scenario with BPM

    Hi Guys
    I have create my Soap to File Scenario using BPM to split the file on "Transformation step" into 7 files and it must save these files to my FTP Server, when testing on sxmb_moni I don't get any errors but when checking on the FTP server no files are created, and I understand that it should be showing all seven processing on the sxmb_moni, but that is not happening.
    I have used the ForEach mode on my Block.
    What could I be doing wrong.
    Thanks!!
    Yonela

    go to runtime work bench to see communication channel, especailly the receiver channel.
    To see what happened on it

  • I have a problem sending files along with thier directories to server

    The Problem is i couldnt understand the sequence in which should the file transfers will execute.....
    Here is the Code ......
    The **************Error************* i get is that it makes one dir then other one and paste one file in it after writing another file in the second loop it gives error on write UTF that Socket write Error COnnection Reset by peer
    ***************************CLIENT************************
    package oam.filemanager;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import oam.beans.*;
    public class FileClient {
    Socket socket;
    DataOutputStream dataout;
    FileBean file;
    public void SetSocket() {
    //Create socket connection
    try {
    socket = new Socket("localhost", 9898);
    dataout = new DataOutputStream(socket.getOutputStream());
    String wavfiles []=null;
    //Directory & Wavfiles Manipulation
    file=new FileBean();
    String dirs []= file.getDirsForSocket("Accounts//");
    for(int i=0;i<dirs.length;i++){
    wavfiles= file.getWavfiles("Accounts//"+dirs[i]+"//");
    //sending Username & DIR
    dataout.writeUTF(dirs);
    if (wavfiles.length==0)
    dataout.writeUTF("no");
    for (int j=0;j<wavfiles.length;j++){       
    //Sending Filename
    dataout.writeUTF(wavfiles[j]);
    //getting file to be send
    File f = new File("Accounts//"+dirs[i]+"//"+wavfiles[j]);
    int fileLength = (int) f.length();
    System.out.println("fileLength " + fileLength);
    byte data[] = new byte[fileLength]; //settting array of byte to file len
    //reading from file acha
    FileInputStream fis = new FileInputStream(f);
    // Send file length
    dataout.writeInt(fileLength); // writing file length
    dataout.flush();
    System.out.println("Length Sent .... " + fileLength);
    dataout.flush();
    // Send file
    int loop = 0;
    loop = fis.read(data);
    System.out.println("......1......" + "in loop" + loop);
    if (loop > -1) {
    dataout.write(data);
    //closeConnection();
    // output.flush();
    catch (UnknownHostException e) {
    System.out.println("Unknown host:");
    System.exit(1);
    catch (IOException e) {
    System.out.println("No I/O " + e.getMessage());
    System.exit(1);
    catch (Exception e){
    e.printStackTrace();
    public static void main(String args[]) {
    FileClient serv = new FileClient();
    serv.SetSocket();
    ******************************************SERVER*********************
    import java.io.*;
    import java.net.*;
    import java.io.*;
    class ClientThread
    implements Runnable {
    FileOutputStream output;
    DataInputStream input;
    String uname;
    String filename;
    Socket client;
    public ClientThread(Socket clientth) {
    this.client=clientth;
    public void checkdir(String dirname){
    File f =new File("..//Accounts//"+uname+"//");
    if (!f.exists()){
    f.mkdirs();
    public void run() {
    try {
    while (true) {
    input = new DataInputStream(client.getInputStream());
    uname = "";
    filename = "";
    uname = input.readUTF();
    checkdir(uname);
    filename = input.readUTF();
    if (!filename.equals("no")) {
    System.out.println("Filename Recieved of file: " + filename);
    File f = new File("..//Accounts//" + uname + "//" + filename);
    if (!f.exists()) {
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
    raf.setLength(0);
    int length;
    int pack = 0;
    int fileLength = 0;
    System.out.println("User Name received...." + uname);
    System.out.println("...2a....");
    fileLength = input.readInt();
    System.out.println("...2b....");
    System.out.println("Length Receieved .... " + fileLength);
    // input.readInt();
    // input.readInt();
    byte data[] = new byte[fileLength];
    System.out.println("Length Receieved .... " + fileLength);
    input.read(data);
    raf.write(data);
    raf.close();
    System.out.println("File Receieved and Wrote at Server");
    // clientoutput.flush();
    else {
    System.err.println("File Already Exists request by " + uname);
    } //if check ends
    catch (IOException e) {
    System.out.println("in or out failed"+ e.getMessage());
    System.exit( -1); }
    public class FileServer {
    Socket client;
    ServerSocket server;
    public FileServer(){
    File f=new File("..//Accounts") ;
    if(!f.exists())
    f.mkdirs();
    public void listenSocket() {
    try {
    server = new ServerSocket(9898);
    catch (IOException e) {
    System.out.println("Could not listen on port 9898 Server Already Listening");
    System.exit( -1);
    while (true) {
    ClientThread cth;
    try {
    cth = new ClientThread(server.accept());
    Thread thr = new Thread(cth);
    thr.start();
    catch (Exception mye) {
    mye.printStackTrace();
    protected void finalize() {
    try {
    server.close();
    catch (IOException e) {
    System.out.println("Could not close socket");
    System.exit( -1);
    public static void main(String args[]) {
    FileServer serv = new FileServer();
    serv.listenSocket();

    Well Thanks a lot : jschell so nice of u helping me all through this well i sort out this problem as well...
    i wasnt sending all files at once ...........one by one the problem was the biggest file is 240 k and byte arraay couldnt accomdate it ................so now i am sending files in 4k packets any of u guys need help u can see this code how to send files in packets .................
    //**********************SERVER************************************
    package servermanager;
    import java.io.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class ClientThread
        implements Runnable {
      FileOutputStream output;
      DataInputStream input;
    DataOutputStream dataout;
      String uname;
      String filename;
      Socket client;
      JTextArea log;
      public ClientThread(Socket clientth,JTextArea mylog) {
        this.client=clientth;
        this.log=mylog;
      public void checkdir(String dirname){
      File f =new File("..//Accounts//"+uname+"//");
      if (!f.exists()){
        f.mkdirs();
      public synchronized  void  startTransfer(){
          try {
              FileOutputStream fos=null;
              input = new DataInputStream(client.getInputStream());
              uname = "";
              filename = "";
              uname = input.readUTF();
              checkdir(uname);
              filename = input.readUTF();
              File f = new File("..//Accounts//" + uname + "//" + filename);
              RandomAccessFile raf = new RandomAccessFile(f, "rw");
              raf.setLength(0);
              raf.close();
              long fileLength=0;
              byte lenbuf[]=null;
              int help =input.read();
              lenbuf = new byte[help];
              input.read(lenbuf);
              String lenz = new String(lenbuf);
              fileLength = new Integer(lenz).longValue();
              fos = new FileOutputStream (f);
              byte data[]=new byte[4096];
              int length;
              while( (length=input.read(data, 0, 4096)) > 0) {
               fos.write(data, 0, length);
              fos.close();
      log.append("\n File Recieved = ["+filename+"]:---:"+"of Size["+fileLength+"]:---:"+"By ["+uname+"]." );
        catch (IOException e) {
          log.append("\n In or Out failed"+e.getMessage());
          System.exit( -1);}
      public void run() {
        startTransfer();
    public class FileServer extends JFrame {
      int port;
      Socket client;
      ServerSocket server;
      JScrollPane textscrollpane = new JScrollPane();
      JTextArea log = new JTextArea();
      JButton clear_btn = new JButton();
      JButton stop_btn = new JButton();
      public FileServer(){
        port=9898;
        File f=new File("..//Accounts")  ;
        if(!f.exists())
         f.mkdirs();
        try {
          jbInit();
        catch(Exception e) {
          e.printStackTrace();
      public void listenSocket() {
        try {
          server = new ServerSocket(port);
        catch (IOException e) {
         log.append("\n Could not listen on port["+port+"]");
         System.exit( -1);
        while (true) {
          ClientThread cth;
          try {
            cth = new ClientThread(server.accept(),log);
            Thread thr = new Thread(cth);
            thr.start();
          catch (Exception  mye) {
         log.append("\n Thread Exception["+mye.getMessage()+"]");
      protected void finalize() {
        try {
          server.close();
        catch (IOException e) {
              log.append("\n Could not Close Socket on port["+port+"]");
          System.exit( -1);
      public static void main(String args[]) {
        FileServer serv = new FileServer();
        serv.setBounds(new Rectangle(150,150,500,300));
        serv.show();
        serv.listenSocket();
      private void jbInit() throws Exception {
        this.getContentPane().setLayout(null);
        textscrollpane.setBounds(new Rectangle(1, 21, 489, 212));
        log.setBackground(Color.black);
        log.setForeground(Color.green);
        log.setToolTipText("Server Log");
        log.setEditable(false);
        log.setLineWrap(true);
        clear_btn.setText("Clear");
        clear_btn.addActionListener(new FileServer_clear_btn_actionAdapter(this));
        clear_btn.setBounds(new Rectangle(323, 245, 86, 13));
        clear_btn.setToolTipText("");
        stop_btn.setToolTipText("");
        stop_btn.setBounds(new Rectangle(55, 246, 86, 13));
        stop_btn.setText("Stop");
        stop_btn.addActionListener(new FileServer_stop_btn_actionAdapter(this));
        this.addWindowListener(new FileServer_this_windowAdapter(this));
        this.getContentPane().add(textscrollpane, null);
        this.getContentPane().add(stop_btn, null);
        this.getContentPane().add(clear_btn, null);
        textscrollpane.getViewport().add(log, null);
        log.setText("Server Initiated Listening on Port [9898]...");
      void stop_btn_actionPerformed(ActionEvent e) {
        System.exit(0);
      void this_windowClosed(WindowEvent e) {
        System.exit(0);
      void this_windowClosing(WindowEvent e) {
    System.exit(0);
      void clear_btn_actionPerformed(ActionEvent e) {
      log.setText("");
    class FileServer_stop_btn_actionAdapter implements java.awt.event.ActionListener {
      FileServer adaptee;
      FileServer_stop_btn_actionAdapter(FileServer adaptee) {
        this.adaptee = adaptee;
      public void actionPerformed(ActionEvent e) {
        adaptee.stop_btn_actionPerformed(e);
    class FileServer_this_windowAdapter extends java.awt.event.WindowAdapter {
      FileServer adaptee;
      FileServer_this_windowAdapter(FileServer adaptee) {
        this.adaptee = adaptee;
      public void windowClosing(WindowEvent e) {
        adaptee.this_windowClosing(e);
    class FileServer_clear_btn_actionAdapter implements java.awt.event.ActionListener {
      FileServer adaptee;
      FileServer_clear_btn_actionAdapter(FileServer adaptee) {
        this.adaptee = adaptee;
      public void actionPerformed(ActionEvent e) {
        adaptee.clear_btn_actionPerformed(e);
    //**********************CLIENT************************************
    package servermanager;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    public class FileClient {
      Socket socket;
      DataOutputStream dataout;
      public   void SetSocket(String dir,String filename) {
        try {
          socket = new Socket("localhost", 9898);
          dataout = new DataOutputStream(socket.getOutputStream());
            //sending Username & DIR name
            dataout.writeUTF(dir);
            //Sending Filename
            dataout.writeUTF(filename);
            dataout.flush();
            File f = new File("Accounts//"+dir+"//"+filename);
            byte data[]=new byte[4096];  //40k
            long filelength=f.length();
            String lenbuf = String.valueOf(filelength);
             byte lenz[] = lenbuf.getBytes(); //file length in bytes
               int lenzLen = lenz.length;
            FileInputStream fis = new FileInputStream(f);
            dataout.write(lenzLen);  //sending length in integer
            dataout.flush();
            System.out.println(lenzLen+"--------First Thing Sent length of byte array");
            dataout.write(lenz);      //sendinf byte  Array length
            dataout.flush();
              System.out.println(lenz+"--------Second Thing Sent bytes");
            int loop=0;
              while(loop!=-1){
                loop=fis.read(data);
                dataout.write(data);
                dataout.flush();
              socket.close();
        catch (UnknownHostException e) {
          System.out.println("Unknown host:");
          System.exit(1);
        catch (IOException e) {
          System.out.println("No I/O   " + e.getMessage());
          System.exit(1);
        catch (Exception e){
          e.printStackTrace();
      public static void main(String args[])  {
        FileClient serv = new FileClient();
        FileBean file=new FileBean();
        String wavfiles []=null;
        String dirs []=  file.getDirsForSocket("Accounts//");
        for(int i=0;i<dirs.length;i++){
        wavfiles= file.getWavfiles("Accounts//"+dirs[i]+"//");
         //if (wavfiles.length==0)
              for (int j=0;j<wavfiles.length;j++){
                  serv.SetSocket(dirs,wavfiles[j]);

  • Sender File Adapter with file conversion  Multimapping

    Hello all,
    i have to use multimapping with the file sender adapter
    XML for multimapping ist like this
    ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>
          <ns1:KVNR_Senden_MT xmlns:ns1="urn:lsv.de/SENDER">
             <Inhalt>
                <KE/>
                <VF/>
                <BBNRAB/>
                <BBNREP/>
                <VERNR/>
                <ED/>
                <FEKZ/>
    in File adapter
    DocumentName Messages
    RecordsetName  Inhalt
    Recorset Struc Inhalt,20
    Inhalt.fieldFixedLength 4,5,6.....
    Inhalt.fieldNames        KE,VF,.....
    but were can I generate Message1?????
    any Hints?
    regards
    ralf

    sorry but the message tags will not be add dynamically
    i have change an existing message mapping 1:1 with file content conversion
    into a multimapping.
    by changing into multimapping the message was surrounded with
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>.......
    no changing in File Adapter an in the IE there was an error
    com.sap.aii.utilxi.misc.api.BaseRuntimeException geworfen: RuntimeException in Message-Mapping transformatio~.
    if i added the stuct
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>.......
    by hand and it works???
    so i think i had to add
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
       <ns0:Message1>.......
    to the file content conversion but i don't know how to do it???
    Ralf

  • Issue in File to RFC to File Scenario with BPM using Block Step

    Hi Everybody,
                           I am doing File to RFC to File Scenario for multiple records using BPM using Block Step. The File Message is getting posted and after that, the message is getting stuck up in the qRFC Monitor (Inbound Queue).
                        After seeing the message in Inbound Queue, I am trying to execute and release the message. But when i execute the LUW, it says " Function module doesnt exist or EXCEPTION raised" in Inbound queue.
    Could somebody suggest me the outcome of this? What does this mean and how to
    release the stuck up message in Queue.
    Thanks and Regards,
    N.Jayanth Kumar

    Hi Rajesh,
                           After going through the blog, i saw the trace messages. It says      
    " The   exception occurred (program: CL_SWF_XI_INBOUND=============CP, include CL_SWF_XI_INBOUND=============CM00F, line: 19)"
    Regards,
    N.Jayanth Kumar

  • Sender file adapter with FCC not creating last field

    Hi,
    I've got the following file:
    field1;field2;field3
    FCC is the following:
    Recordset streucture: ITEM,*
    ITEM.fieldSeparator     ;
    ITEM.endSeparator     'nl'
    ITEM.fieldNames FIELD1,FIELD2,FIELD3
    ignoreRecordsetName     true
    I expect to generate the following XML:
    <FIELD1>field1</FIELD1>
    <FIELD2>field2</FIELD2>
    <FIELD3>field3</FIELD3>
    That's working OK. The problem is when I receive a file with the FIELD3 empty. Example:
    field1;;
    I expect:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    </FIELD3>
    But I get:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    And this raises an error during the mapping because the FIELD3 is mandatory in the Data Type definition, even it's empty

    I expect:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    </FIELD3>
    But I get:
    <FIELD1>field1</FIELD1>
    </FIELD2>
    use a mapwithdefault in your mapping so that it will always create an empty node if there was no value to be mapped to the target field.

  • Same sender file name with a different extension

    Hello Friends,
    My scenario is I have an xyz.xml file coming and i need to have the same file name in the receiver but with a different extension as xyz.csv and the source file name will not be the same, it will be changing.
    Can you please help me on this.this is a bit urgent to me.
    Thanks in advance.
    Regards,
    Kumar

    Kumar,
    Write <b>UDF</b> with <b>no input</b> parameters.
    DynamicConfiguration conf = (DynamicConfiguration) container
        .getTransformationParameters()
        .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
        “http://sap.com/xi/XI/System/File”,
        “FileName”);
    String fname = conf.get(key);
    StringTokenizer st = new StringTokenizer(fname,".");
    String[] name = new String[2];
    while(st.hasMoreElements())
    for(int i=0;i<1;i++)
    name<b>[</b>i<b>]</b>=st.nextElement();
    String finalname = name[0]+".csv";
    conf.put(key,finalname);
    <b>Mapping Logic</b>
    UDF -
    > Target Rootnode.
    Make sure that u checked the Adapter specific message attributes in both comm.channel.
    If you have doubts reply back.
    Best regards,
    raj.
    Message was edited by:
            Raj

  • FF7 can't upload/send files anymore with ajaxplorer anymore.

    Since updating to Firefox 7, I can no longer upload files via Ajaxplorer.
    The site loads properly but when browsing to send the file, nothing happens and the upload function works fine in IE and Chrome.
    A lot of clients use this software so it's a real problem if FF7 doesn't work.
    If you visit http://www.ajaxplorer.info/wordpress/forum/ and search ff7 you'll see a post for this.
    Unfortunately, there's not direct link
    thx

    Sounds like something in AjaXplorer which needs to be fixed.
    http://www.ajaxplorer.info/wordpress/forum/?vanilla_redir=discussion%2F2276%2Ffirefox-7-beta-file-upload-not-selecting-files#
    Looks like a fix has been implemented in AjaXplorer 4 beta 1.
    '''''archan''''' also mentioned a fix he did, but it broke something else.

  • When client send file  connection with server close

    please help me.
    i want to transfer a file via server - client model.
    Client send the file, server receive it.
    Then when i send a msg from server to client i have this error:
    java.net.SocketException: socket closed
    why the socket closed?

    client waiting for response. i don't know what to do.
    the client code is:
    import java.net.*;
    import java.io.*;                              
    class Client{               
         Socket clientSocket;               
           byte[] byteArray;                    
           BufferedInputStream bis;          
            BufferedOutputStream bos;          
           int in;                                   
           BufferedReader inm = null;
            PrintWriter outm = null;
           public Client(){
             try{
                    clientSocket = new Socket("localhost", 9632);
                   System.out.println("i am client & connect");
                   inm = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                   outm = new PrintWriter(clientSocket.getOutputStream(), true);
                   System.out.println("------1--------" +clientSocket.isClosed());
                      outm.println("msg 1: hi");
                      System.out.println("from server__ " +inm.readLine());
                      outm.println("msg 2: now i will send you a file");
                      System.out.println("from server__ " +inm.readLine());
                      sendFile();
                     System.out.println("-------2-------" +clientSocket.isClosed());
                      System.out.println("from server__ " +inm.readLine());
             catch(IOException e){
                    e.printStackTrace();
           public void sendFile(){
                try{
                     bis = new BufferedInputStream(new FileInputStream("encryptAtmMsg.txt"));
                    bos = new BufferedOutputStream(clientSocket.getOutputStream());
                    byteArray = new byte[8192];
                    while ((in = bis.read(byteArray)) != -1){
                       bos.write(byteArray,0,in);
                        bis.close();
                      bos.close();
               catch(IOException e){
                    e.printStackTrace();
           public static void main(String[] args){
             new Client();
    }And server code is:
    import java.net.*;
    import java.io.*;
    class Server{
         BufferedInputStream bis;
           BufferedOutputStream bos;
           byte[] data;
           Socket socket;
           ServerSocket serverSocket;
           int in;
            BufferedReader inm = null;
            PrintWriter outm = null;
           public Server(){
             try{
                    serverSocket = new ServerSocket(9632);
                    System.out.println("i am server & listening...");
                   socket = serverSocket.accept();
                     System.out.println("a client connect");
                   System.out.println("------1--------" +socket.isClosed());
                    inm = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                    outm = new PrintWriter(socket.getOutputStream(), true);
                   System.out.println("from client: " +inm.readLine());
                     outm.println("ack 1: hi....");
                     System.out.println("from client: " +inm.readLine());
                     outm.println("ack 2: ok....");
                    receiveFile();
                      System.out.println("------2--------" +socket.isClosed());
                   outm.println("ack 3: take the file");
             catch (IOException e){
                  e.printStackTrace();
         public void receiveFile(){
              try{
                  byte[] receivedData = new byte[8192];
                 bis = new BufferedInputStream(socket.getInputStream());
                   bos = new BufferedOutputStream(new FileOutputStream("encryptAtmMsg22.txt"));
                 while ((in = bis.read(receivedData)) != -1){
                       bos.write(receivedData,0,in);
                 bos.close();
             catch (IOException e){
                  e.printStackTrace();
         public static void main(String[] args){
             new Server();
    }any idea pls

  • Sender file channel with name as *.xml

    Hi All.
    I have a file to file scenario from a ftp server.
    When the name of the file is abc.xml in the communicaiton channel the scenario works fine, but as soon as I change it to
    a*.xml I get the error as below
    The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 520 Unexpected reply codeControl connection prematurely closed by server'. For details, contact your FTP server vendor.
    Edited by: Ravindra Teja on Aug 8, 2011 9:43 AM

    There's no bug for this functionality.
    I've use it in many cases.
    Probably there's some issue in FTP connection, try to test command directly from your PI system, like follow:
    FTP <hostname>
    (user&password)
    cd <directory>
    ls *.xml
    mget <filename>
    Check if it work.

Maybe you are looking for

  • Indesign cs6, smart guides on, transform not proportional

    i use my smart guides a lot. i have found that when i go to transform an image using the direct select tool, and the cmd+shift function, the percentage of the scale is not consistant on teh x and y axis (they should be the same). i do have the "const

  • When will a camera raw plugin beavailable for the Nikon D810

    I recently purchased a Nikon D810 but can not see the images when I download them to either Lightroom or Photoshop.  I am told I need a new plug-in. When will onebe available?

  • A GP Question

    Hi all. i have made a gp process at gp - runtime i set all the roles  to the users and then the process is initiated but i want that these roles be fixed- ie at every run the same set of  users / roles work on that process = i do not to initiate them

  • Help: Very simple HTTPService issue

    I have created very simple test : <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%"> <mx:Script><![CDATA[ import mx.rpc.http.HTTPService; [Bindable] public v

  • Mail Local Storage on Mac Needed if Using Me/iCloud?

    I have a Macbook Air running the latest build of Mountain Lion. I have a .me email address. I created a duplicate email folder on my Mac for each folder I have with iCloud. When I save copies of emails, I save a copy to my local folder on Mac and a a