Looking to create file based socket server (like mysql.sock)

Hello, I am fairly new to Java and have been trying to find the way to develop a very simple socket server, but one that listens/writes to a file rather than something that is bound to a port number. This would be like mysql.sock type functionality where processes running on the same server can access the java server via a file rather than ip/port.
Thanks for any and all help,
Chad.

Dang, ok thanks.
Message was edited by:
builderchad
Message was edited by:
builderchad

Similar Messages

  • How to create file on application server?

    how to create file on application server?

    Hi,
    The following program illustrates the creation of ifle in app server and reading the file from appli server:
    DATA: ITAB LIKE vbakOCCURS 0 WITH HEADER LINE.
    PARAMETERS: P_VBELN LIKE VBAP-VBELN.
    START-OF-SELECTION.
      SELECT *
        FROM VBAP
        INTO TABLE ITAB
    WHERE VBELN = P_VBELN
        PERFORM WRITE_DATA.
        PERFORM READ_DATA.
    *&      Form  WRITE_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_DATA.
    OPEN DATASET 'VBAP_DATA' FOR OUTPUT IN TEXT MODE.
    LOOP AT ITAB.
    TRANSFER ITAB TO 'VBAP_DATA'.
    ENDLOOP.
    CLOSE DATASET 'VBAP_DATA'.
    CLEAR: ITAB, ITAB[].
    ENDFORM.                    " WRITE_DATA
    *&      Form  READ_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM READ_DATA.
    OPEN DATASET 'VBAP_DATA' FOR INPUT IN TEXT MODE.
    DO.
    READ DATASET 'VBAP_DATA' INTO ITAB.
    IF SY-SUBRC <> 0.
    EXIT.
    ENDIF.
    APPEND ITAB.
    ENDDO.
    CLOSE DATASET 'VBAP_DATA'.
    LOOP AT ITAB.
    WRITE:/ ITAB-VBELN,
            ITAB-POSNR.
    ENDLOOP.
    ENDFORM.                    " READ_DATA
    If it is helpful rewards points
    Regards
    Pratap.M

  • How to create file based on date value

    Hi
    Hope you'll help me. I can't find right way to tackle the problem. I need to read a file which name is created based on month and years' value. File name format is as follows: INMMYY.log. So to read it I must create File object using this file name format. I tried to use Calendar class get necessary information using get() method. Unfortunatelly returned month's value is always 2,3,4 and so on..(I need 02,03). There is problem with year's value als. It's returned in form YYYY but I need YY.
    Does anybody have any idea how to create string INMMYY in the easiest way ??
    Thanks in advance :)

    Use java.text.SimpleDateFormat.

  • FTP without creating files on Application server

    hello everyone,
    in an internal table i have around 100 records each of length around 3500 chararters. i want to send this data to the client via ftp in the form of txt file. since the lenght of each record  exceeds 1000 bytes, i thought of sending the data directly to the ftp server without creating the file on the application server. is this feasible. please provide the necessary steps to achieve this.

    Hi,
    The FTP involves a lot of complexity but you can do the SCP(secure copy) instead. And what u can do is first create a file on application server and then u can delete it...
    the sample code is below..
    #!/bin/ksh
    scp <filename> <destination>
    rm -f <filename>

  • Stream based socket , server implementation

    Please help me with this simple server and socket problem.
    SERVER_
    package com.supratim;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.net.ServerSocket;
    import java.net.Socket;
    public class SocketServer {
         private static ServerSocket server;
         public static void main(String[] args) throws IOException {
              server = new ServerSocket(9999);
              new SocketServer().go();
         private void go() throws IOException {
         while(true) {
              Socket socket = server.accept();
              DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());
              DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream());
              byte[] buff=new byte[dataInputStream.available()];
              int i;
              while((i=dataInputStream.read())>0) {
                   dataInputStream.read(buff, 0, buff.length);
              String inputMessage="INPUT MESSAGE OBTAINED : "+new String(buff);
              byte[]outputBuffer = inputMessage.getBytes();
              dataOutputStream.write(outputBuffer);
              dataOutputStream.flush();     
              socket.close();
    CLIENT+
    package com.supratim;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class SocketClient {
         public static void main(String[] args) throws UnknownHostException, IOException {
              new SocketClient().go();
         private void go() throws UnknownHostException, IOException {
              Socket socket = new Socket("localhost",9999);
              InputStream dataInputStream = socket.getInputStream();
              OutputStream dataOutputStream = socket.getOutputStream();
              String inputMessage="ABCDEFGHIJKLMNOPQRSTWXYZ";
              byte[]outputBuffer = inputMessage.getBytes();
              dataOutputStream.write(outputBuffer);
              dataOutputStream.flush();     
              byte[] buff=new byte[dataInputStream.available()];
              int i;
              while((i=dataInputStream.read())>0) {
                   dataInputStream.read(buff, 0, buff.length);
              System.out.println("RESPONSE : "+new String(buff));
              socket.close();
    }When I try to connect to the SERVER from CLIENT, nothing happens. As soon as I terminate the CLIENT, the following stack trace comes...
           Exception in thread "main" java.net.SocketException: Connection reset
            at java.net.SocketInputStream.read(SocketInputStream.java:168)
            at java.net.SocketInputStream.read(SocketInputStream.java:182)
            at java.io.FilterInputStream.read(FilterInputStream.java:66)
            at com.supratim.SocketServer.go(SocketServer.java:26)
            at com.supratim.SocketServer.main(SocketServer.java:14)Please tell me, am I missing something??
    I dont want to use PrintWriter,BufferedReader,BufferedWriter...

    jverd wrote:
    supratim wrote:
    jverd wrote:
    supratim wrote:
    tjacobs01 wrote:
              while((i=dataInputStream.read())>0) {
                   dataInputStream.read(buff, 0, buff.length);
              }This is your problem. InputStream.read is going to block progressif it is so...how am I suppose to check the end of the stream....what is the way out??I'm not really sure what problem you're having or what you're asking. However, if your problem is that you want your server to be able to accept new connections while it's servicing an earlier conneciton--that is, service multiple requests at once--then, clearly, you need to use multiple threads. At the very least, one for accepting connections and one for servicing the requests that come on those connections.The problem is when the client is connecting to send a message as a byte stream...the message does not reach there..eventually the connection resets... why is that?? which part of the SocketServer is being blocked...and what is its way out??
    Let's say it is used in a single threaded environment..only one client is connecting at a time...Does the client flush()? Does it close() the Socket's OutputStream?
    If you don't flush(), data that you have sent may not be received.
    If you don't close(), the server won't know the client is done sending, so he'll never get the -1.
    (Or, alternative to calling OutputStream.close(), you could call Socket.shutdownOutput(), I think.)
    Edited by: jverd on Jul 12, 2011 10:49 AMplease check the code...flushing...closing are all there...

  • Read file from presentation server (like GUI_UPLOAD)

    Hi,
    I need to read a txt file from local pc path in CRM WEB UI runtime. The path and the filename are already known, so I don´t need the control provided by thtmlb:fileUpload control, which automatically adds a u2018Browseu2019 button. I need to read this file without any additional controls or buttons.
    I tried with RZL_READ_FILE, but doesn´t work with local files, only with application server files.
    As you all know, GUI_UPLOAD doesn´t work in WEB UI...I need exactly something like that!
    Any help or suggestion wil be appreciated.
    Thanks in advance.
    Federico.

    Hi Federico,
    When it comes to web browser (web ui) file upload cannot be done as it is done in SAP GUI. There is a mechanism called 'Form-based File Upload in HTML' through which file is uploaded from web browser to the server, at the back end this is what is used. So you have to use a fileUpload tag to upload a file from web browser.
    As an alternative solution, you can use Javascript and activexobjects to upload files. I have developed a wiki which explains excel upload using activexobjects and javascript.
    http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebUI-UploadingdatafromExcelfiles
    Regards,
    Arun

  • How do I stop Mac creating files on Windows server creating hidden files?

    I have my macbook connecting to a windows 2003 server share. Whenever I write a file, either by creating or editing and saving, it creates a hidden file too. I edit filename.doc then I'll also have ._filename.doc in that directory. It's distracting the windows users and causing me to become a little unpopular. How can I prevent those hidden files from being created?

    This happens in part with some Mac files that contain both a resource and a data fork. Windows doesn't know how to handle these files and breaks them apart. Also, Mac OS creates certain hidden files used by the Finder that also get transferred but are no longer hidden on Windows because Windows does not recognize the "." preceding a filename as the Unix shorthand for "invisible."
    There are a number of free utilities you will find at VersionTracker or MacUpdate that can prevent this and the hidden files from appearing on the Windows drive.
    Zipping files before transfer will also prevent the problem from occurring.

  • Directory structure of file based content server

    Hi,
    does anybody know how the contentserver manages his directory structure?
    Looks like:
    0ebf
    0ec0
    0ec1
    0ec2
    0ec3
    0ec4
    0ec5
    0ec6
    0ec7
    I need to know the 4-digit directory in which my ID ( for example: 4bfee75d19d04548e10000000a320513) is saved.
    Any ideas?
    Best regards, martin

    Hello Martin,
    I've got the same Problem.
    Did you solve it?
    Massimo

  • Transfer file to different server after it get created in DB server

    Hi All,
    I have a unix shell script that runs in a Linux server and connects to database (using sqlplus of course) and creates a file using UTl_FILE package and which gets created in DB server. We are not actually supposed to create file in DB server as per company rules and regulations. But as a workaround until we find a solution, we are being allowed to create file in DB server then my DBA scp the file to the Linux server. This manual process of transferring the file has to be automated or if possible, it would be best if we can create the file in the target Linux server itself instead of DB server.
    Is there any way of doing so or if this issue has been addressed in past, please provide me with the link. I tried to search in forum but couldn't fine one appropriate solution.
    Thanks,
    Samip

    I am trying to find a work around. Instead of file creation, I am going for a PL/SQL process that will directly load into the target table.
    I will try to explain my problem as much as possible.
    Lets say I have a table A. It's a hierarchy table. X is the parent column while Y is the child one. '1' is the TOPmost in the hierarchy so, value in X corresponding to '1' is NULL.
    Table A
    X--------Y
    ----1
    1-----     2
    1-----     3
    2-----     4
    2-----     5
    2-----     6
    3-----     7
    3-----     8
    4-----     9
    4-----     10
    5-----     11
    5-----     12
    7------     13
    7-----     14
    11----     15
    11----     16
    I need to transform table A to table B like below:
    Table B
    L1----     L2----     L3----     L4----     L5
    1----     1----     1----     1----     1
    1----     2----     2----     2----     2
    1----     3----     3----     3----     3
    1----     2----     4----     4----     4
    1----     2----     5----     5----     5
    1----     2----     6----     6----     6
    1----     3----     7----     7----     7
    1----     3----     8----     8----     8
    1----     2----     4----     9----     9
    1----     2----     4----     10----     10
    1----     2----     5----     11----     11
    1----     2----     5----     12----     12
    1----     3----     7----     13----     13
    1----     3----     7----     14----     14
    1----     2----     5----     11----     15
    1----     2----     5----     11----     16
    Here, each row (value in Y) in table A is processed and are put in correct Level. For example 1 has Level 1 So, it is under L1 and then rest of the columns are filled with 1. 2 has level 2, so it is put under L2 and the it parent is 1 so, 1 in L1 - obvious, then rest of the column filled with 2. Likewise 14 has level 4 so put under L4, then the hierarchy values upward are found and put under respective columns; L5 is entered 14. Basically the hierarchy up is calculated for each value in Y is calculated and put under respective level column in table B and then the rest of the columns are just filled with the column Y value that was processed.
    Thanks in advance. Please help me on this write a procedure or any process that will accomplish this task.
    Thanks,
    Samip
    Edited by: 908006 on Apr 15, 2013 1:11 PM
    Edited by: 908006 on Apr 15, 2013 1:11 PM
    Edited by: 908006 on Apr 15, 2013 1:12 PM
    Edited by: 908006 on Apr 15, 2013 1:12 PM
    Edited by: 908006 on Apr 15, 2013 1:12 PM
    Edited by: 908006 on Apr 15, 2013 1:15 PM
    Edited by: 908006 on Apr 15, 2013 1:15 PM
    Edited by: 908006 on Apr 15, 2013 1:16 PM

  • Regarding downloading file on application server ?

    i am using open data set and close data set to create file on application server.
    the program is compiling fine, but when i execute it, it throws a dump saying
    DATASET_NOT_OPEN  , it says that the file is not open.
    when i check value of sy-sub-rc it is 8. no file on server.
    i want to create a dynamic file name, like i want to append the sy-cdate to the file name, so that when i schedule my program every day, i will create a new file.
    what is the t-code to look at directories on app server. i tried al11, but couldnt find mine..but the basis said they had already created a folder for me there.
    - Points will be awarded for inputs.
    Message was edited by:
            ravi a

    Hi,
    May be you don't have write permission for the corresponding folder on the application server. thats why you could not create file on that folder.so ask you basis people for read/write permission on the that destination folder..
    For creating dynamic file , you can use logical file and physical file concept..
    for each interface maintain a logical file name in a ztable and ask your basis people to maintain a physical file path on application server for each logical file name.(using FILE Txn).
    first get the logical file name from ztable then get corresponding physical path onapplication server using FM 'FILE_GET_NAME' and finally concatenate the sydatun to physical file name...
    DATA: l_file_folder TYPE string,
            l_logical_file TYPE fileintern,
      CLEAR: file1.
    *<b> First get the logical file name from table zabc021</b>
      SELECT SINGLE log_file " Actual file location
                         INTO l_logical_file
      FROM zabc021
      WHERE interface = p_interface
        AND inorout = 'O'. "outbound interface
    <b>* Get the physical file name from the logical file name</b>
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
      CLIENT                        = SY-MANDT
          logical_filename              = l_logical_file
       IMPORTING
         file_name                     = l_file_folder
       EXCEPTIONS
         file_not_found                = 1
         OTHERS                        = 2
      IF sy-subrc = 0.
    <b>* In actual situation the file name should come from FILE txn</b>
        CONCATENATE l_file_folder
        p_interface '_' sydatum4(2) sydatum6(2) '.DAT' INTO file1.
      ELSE.
        CLEAR file1.
        MESSAGE s999 WITH 'No logical file maintained with name ' l_logical_file.
        EXIT.
      ENDIF.
    now file1 is the file name.
    I hope this info is useful to you...
    Reward if needful

  • File based event not triggering

    We are facing issue in file based event  scheduling.
    Files are getting created on the server path.But the event server is not  trigerring the event upon file creation.
    File Path is also correct.
    I checked the event server metrics ,In List of Monitored files,Last Notified Time is blank.
    This was all working fine since last 3 months.
    Recently we had some antivirus upgrades on server,after that this problem has started.
    I can read write and create files on the server path.But event is not getting fired.
    Server Details
    BO 3.1 FP 3.5
    Edited by: Rizwan Aamir on May 14, 2011 1:39 PM
    Edited by: Rizwan Aamir on May 14, 2011 1:40 PM

    I checked abot the userID used to restart SIA from Server Team.
    They Said the userid is not a NT id its a BO user ID Admininistrator account .
    Is it True that LoginID used to restart the SIA is a BO User ID and not a NT login ID.

  • How to link Excel 2010 .XLSX file to SQL server 2008R2 - a method that actually works?

    I have been trying unsuccessfully to link my excel file to SQL server like I used to with SQL 2005.
    In SQL 2008R2 I have installed the 64-bit data access components from Office 2010 to get the  provider 'Microsoft.ACE.OLEDB.12.0' avilable.
    When I try this command:
    SELECT
    FROM
    OPENDATASOURCE(
    'Microsoft.ACE.OLEDB.12.0',
    'Data Source="E:\ADUpdates\Employee List1.xlsx"; Extended properties=Excel 12.0')...[Sheet1$]
    I get this error:
    Msg 7399, Level 16, State 1, Line 1
    The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. Access denied.
    Msg 7301, Level 16, State 2, Line 1
    Cannot obtain the required interface ("IID_IDBCreateCommand") from OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".
    The Access Denied error seems to be form the worksheet and not the file itself. Evidence is that if I enter a bogus sheet name it tells me the sheet doesn't exist and after this error the file is locked open and can't be saved again from Excel until the
    query windows is closed. The sheet is not protected in Excel so I don't know how access to it can be denied.
    Does anyone actually have this working in SQL 2008R2?

    Some minor progress on this issue by running SQL Server service under a domain account with Administrator priv on the SQL server.
    This query now works in a query window:
    SELECT * FROM OPENDATASOURCE( 'Microsoft.ACE.OLEDB.12.0', 'Data Source="E:\ADUpdates\Employee List.xlsx"; Extended properties=Excel 12.0')...[EmployeeData];
    However, creating a Linked server object for the same spreadsheet still does not work:
    EXEC master.dbo.sp_addlinkedserver @server = N'TEST', @srvproduct=N'Excel 12.0', @provider=N'Microsoft.ACE.OLEDB.12.0', @datasrc=N'E:\ADUpdates\Employee List.xlsx'
    The test connection to the linked server failed.
    Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "TEST".
    OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "TEST" returned message "Unrecognized database format 'E:\ADUpdates\Employee List.xlsx'.". (Microsoft SQL Server, Error: 7303)
    For help, click:
    http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=7303&LinkId=20476
    Naturally, the help link provided only confirms the contempt microsoft holds for their customers by not providing any information at all.
    (appologies for the weird colour and fonts, this is a microsoft product, just have to live with obvious defects).

  • Comunication question for socket server and socket client

    I created a simple socket server and a socket client
    The server receive request from server and send same request back to the client.
    Please see example code as below:
    package socket;
    import java.net.*;
    import java.io.*;
    public class SimpleServer {
    public SimpleServer(int listen_port) {
    this.listen_port = listen_port;
    public static void main(String[] args) {
    SimpleServer server = new SimpleServer(4444);
    server.acceptConnections();
    public void acceptConnections() {
    try {
    ServerSocket server = new ServerSocket(listen_port);
    Socket incomingConnection = null;
    while (true) {
    incomingConnection = server.accept();
    handleConnection(incomingConnection);
    } catch (BindException e) {
    System.out.println("Unable to bind to port " + listen_port);
    } catch (IOException e) {
    System.out.println("Unable to instantiate a ServerSocket on port: " + listen_port);
    public void handleConnection(Socket incomingConnection) {
    try {
    InputStream inputFromSocket = incomingConnection.getInputStream();
    BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputFromSocket));
    PrintWriter streamWriter = new PrintWriter(incomingConnection.getOutputStream());
    StringBuffer sb = new StringBuffer();
    String line = null;
    int i = 0;
    while((line=streamReader.readLine())!=null){
    streamWriter.println(line);
    break;
    streamWriter.close();
    streamReader.close();
    incomingConnection.close();
    } catch (Exception e) {
    protected int listen_port;
    //socket client
    package socket;
    import java.io.*;
    import java.net.*;
    import java.util.Iterator;
    import java.util.List;
    import java.math.*;
    public class Simple {
    public Simple(String host_ip, int host_port) {
    this.host_ip = host_ip;
    this.host_port = host_port;
    public static void main(String[] args) {
    Simple simple = new Simple("192.168.254.134", 4444);
    simple.setUpConnection();
    try {
    String result = simple.getResponse("This is first request");
    String result2 = simple.getResponse("This is second request");
    simple.tearDownConnection();
    catch (Exception e) {
    System.out.println("error");
    e.printStackTrace();
    public void setUpConnection() {
    try {
    // Create new socket object
    Socket client = new Socket(host_ip, host_port);
    socketReader = new BufferedReader(new InputStreamReader(client.
    getInputStream()));
    socketWriter = new PrintWriter(client.getOutputStream());
    } catch (UnknownHostException e) {
    System.out.println(
    "Error setting up socket connection: unknown host at " +
    host_ip + ":" + host_port);
    catch (IOException e) {
    System.out.println("Error setting up socket connection: " + e);
    public String getResponse(String request) {
    StringBuffer fileLines = new StringBuffer();
    try {
    socketWriter.println(request);
    socketWriter.flush();
    String line = null;
    int i = 0;
    int chars = 0;
    int sizeOfBuffer = 100;
    char[] cbuf = new char[sizeOfBuffer];
    while ( (chars = socketReader.read(cbuf)) >= 0) {
    fileLines.append(cbuf, 0, chars);
    } catch (Exception e) {
    e.printStackTrace();
    return fileLines.toString();
    public void tearDownConnection() {
    try {
    socketWriter.close();
    socketReader.close();
    } catch (IOException e) {
    System.out.println("Error tearing down socket connection: " + e);
    protected BufferedReader socketReader;
    protected PrintWriter socketWriter;
    protected String host_ip;
    protected int host_port;
    I send two request at the same time.
    Please see code in main method of Simple class
    String result = simple.getResponse("first");
    String result2 = simple.getResponse("second");
    What I think is the socket server will send the same request back to the client.
    So value of result and result2 should be 'first' and 'second'
    But it always return empty String for result2.
    What's the problem?
    Thanks for your help

    Your code has a couple of problems.
    1) the server doesn't flush its socket, so nothing will actually be sent until the socket is closed.
    2) the client getResponse() reads until end of file, so an attempt to use it a second time will fail
    3) in a real application the server should use threads. See the echo server I posted in http://forum.java.sun.com/thread.jsp?forum=11&thread=526980 reply 3.
    Also, please use the [code]  tags when posting source. The lack of these is probaly why you haven't had any repiles until now.

  • File from application server -Read and process and delete the file .

    Hi All,
             I writing a ZEE program which will read the file from application server(file will be in text delimat format) and moving the data to internal table and uploadind data base.The part which iam facing problem is -
    > I hve read the file from application server like below ,
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    EXIT.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
    Spliting part i having problem .i need to seperate each field which is seperate from tab delimite and pass it into respective fields of internal table .
    Second if another file come to the appicaltion server , wether my first file will be there ? or should i need to delete the first file after redaing how should i proceed further ?.
    Regards
    SRIRAM...
    THANKS In ADVANCE

    HI,
    1.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    EXIT.
    ELSE.
    DO.
    CLEAR: wa_string, wa_uploadtxt.
    READ DATASET ld_file INTO wa_string.
    IF sy-subrc NE 0.
    EXIT.
    ELSE.
    SPLIT wa_string AT cl_abap_char_utilities=>horizontal_tab INTO wa_uploadtxt-name1
    wa_uploadtxt-name2
    wa_uploadtxt-age.
    APPEND  wa_uploadtxt TO itab.
    ENDDO.
    CLOSE DATASET ld_file.
    ENDIF.
    2. If the another file get's generated in the application server with same file name then the data in old file get's over written with the new data. You are not required to delete the file.

  • How to delete file from Window server

    Hi
    Can anybody tell me that Is there any function module for deleting file from presentation server like C directory.
    Quick suggestion will highly be appreciated!!!!!!!

    Try this:
    CALL METHOD cl_gui_frontend_services=>file_delete
      EXPORTING
        filename             =
      changing
        rc                   =
    EXCEPTIONS
       FILE_DELETE_FAILED   = 1
       CNTL_ERROR           = 2
       ERROR_NO_GUI         = 3
       FILE_NOT_FOUND       = 4
       ACCESS_DENIED        = 5
       UNKNOWN_ERROR        = 6
       NOT_SUPPORTED_BY_GUI = 7
       WRONG_PARAMETER      = 8
       others               = 9
    this is pretty gud approach .
    Message was edited by:
            Nishant Rustagi

Maybe you are looking for