File thansfer through socket problem

i am writing server /client program, where the server wait for client request to send or receive file through socket.
can i use 1 socket to handle the request (client want to send or download file) and file data transfer?
if yes, how to handle the beginging of file transfer after receive a request?
and how can server know when the file transfer is completed?

This tutorial should help:
http://java.sun.com/docs/books/tutorial/networking/index.html

Similar Messages

  • File reading through Sockets???

    Hello,
    My application has a server and it has to read a file that is sent by the client.. how can the server read a file sent by the client through sockets?????
    Edited by: s_coder on Feb 19, 2009 11:20 PM

    s_coder wrote:
    Yes i read it but there input is given from the client to the server through the standard input stream.... how can i transfer a file thru the standard input stream? and the accept it at the server side???Come on mate. You need to be able to add two and two on your own.
    WTF is a "standard input stream"? And why if you followed the tutorial can you not figure out how to send the data of a file through a socket?
    Either you didn't really read the tutorial or you're pretty darn hopeless. Why don't you try and really follow the tutorial, not just glance at each page but understand what it is saying. Then make an attempt to write your program and if you get stuck come back with your code. Be sure to use the code formatting tags when you show us your code.

  • File transfer via socket problem (with source code)

    I have a problem with this simple client/server filetransfer program. When I run it, only half the file is transfered via the net? Can someone point out to me why this is happening?
    Client:
    import java.net.*;
    import java.io.*;
         public class Client {
         public static void main(String[] args) {
              // IPadressen til server
              String host = "127.0.0.1";
              int port = 4545;
              //Lager streams
              BufferedInputStream fileIn = null;
              BufferedOutputStream out = null;
              // Henter filen vi vil sende over sockets
              File file = new File("c:\\temp\\fileiwanttosend.jpg");
    // Sjekker om filen fins
              if (!file.exists()) {
              System.out.println("File doesn't exist");
              System.exit(0);
              try{
              // Lager ny InputStream
              fileIn = new BufferedInputStream(new FileInputStream(file));
              }catch(IOException eee) {System.out.println("Problem, kunne ikke lage fil"); }
              try{
              // Lager InetAddress
              InetAddress adressen = InetAddress.getByName(host);
              try{
              System.out.println("- Lager Socket..........");
              // �pner socket
              Socket s = new Socket(adressen, port);
              System.out.println("- Socket klar.........");
              // Setter outputstream til socket
              out = new BufferedOutputStream(s.getOutputStream());
              // Leser buffer inn i tabell
              byte[] buffer = new byte[1024];
              int numRead;
              while( (numRead = fileIn.read(buffer)) >= 0) {
              // Skriver bytes til OutputStream fra 0 til totalt antall bytes
              System.out.println("Copies "+fileIn.read(buffer)+" bytes");
              out.write(buffer, 0, numRead);
              // Flush - sender fil
              out.flush();
              // Lukker OutputStream
              out.close();
              // Lukker InputStrean
              fileIn.close();
              // Lukker Socket
              s.close();
              System.out.println("File is sent to: "+host);
              catch (IOException e) {
              }catch(UnknownHostException e) {
              System.err.println(e);
    Server:
    import java.net.*;
    import java.io.*;
    public class Server {
         public static void main(String[] args) {
    // Portnummer m� v�re det samme p� b�de klient og server
    int port = 4545;
         try{
              // Lager en ServerSocket
              ServerSocket server = new ServerSocket(port);
              // Lager to socketforbindelser
              Socket forbindelse1 = null;
              Socket forbindelse2 = null;
         while (true) {
         try{
              forbindelse1 = server.accept();
              System.out.println("Server accepts");
              BufferedInputStream inn = new BufferedInputStream(forbindelse1.getInputStream());
              BufferedOutputStream ut = new BufferedOutputStream(new FileOutputStream(new File("c:\\temp\\file.jpg")));
              byte[] buff = new byte[1024];
              int readMe;
              while( (readMe = inn.read(buff)) >= 0) {
              // Skriver filen til disken ut fra input stream
              ut.write(buff, 0, readMe);
              // Lukker ServerSocket
              forbindelse1.close();
              // Lukker InputStream
              inn.close();
              // flush - sender data ut p� nettet
              ut.flush();
              // Lukker OutputStream
              ut.close();
              System.out.println("File received");
              }catch(IOException e) {System.out.println("En feil har skjedd: " + e.getMessage());}
              finally {
                   try {
                   if (forbindelse1 != null) forbindelse1.close();
                   }catch(IOException e) {}
    }catch(IOException e) {
    System.err.println(e);
    }

    Hi!!
    The problem is at this line:
    System.out.println("Copies "+fileIn.read(buffer)+" bytes");
    Just comment out this line of code and see the difference. This line of code causes another "read" statement to be executed, but you are writing only the data read from the first read statement which causes approximately half the file to be send to the server.

  • Tansfer files through socket

    Hi all
    Can anyone tell me that how can i send files from server to the client through socket programming.
    if u recommend to send file using
    int read(byte[] b, int offset, int blength)
    void write( byte[] b, int offset, int blength) then how plz tell me how can use these methods to send a receive files??? if u give a small example code then i will very greatful to u.
    Usman

    Thanks for ur help.
    but i have got it. i have designed a client and server. Client requests the server to send a specif file (Client takes the path of file from user). And server sends the file to the client.
    I have checked this program on many files. like *.exe, *.txt, *.dat, *.zip, *.mp3, *.jpg.
    it worked smoothly. I have test to trasfer a file of 700MB and it worked correctly.
    Ooops! i did not check it on Network. i run these program on my own computer. both client and server were running on same computer.
    but i am facing a little problem. that is: the speed of trasfering the files is very slow.
    any1 know how to increase the speed of data transfer over the sockets ???
    And plz tell me how can i trasfer a complete directory just as i trasfered file over the sockets. (Remember: a dircetory may or may not contains may other files and also other directories
    thanks in advance...!!!
    here is the code:
    *          CLIENT            *
    import java.net.*;
    import java.io.*;
    public class TransferClient
        public static void main(String[] args)
            try
                 int fileSize = 0;
                 int readBytes = 0;     
                 final int BUFFER_SIZE = 512;
                 byte[] buffer = new byte[BUFFER_SIZE];       
                   Socket sockClient = new Socket(InetAddress.getLocalHost(),2000);     
                   DataInputStream dataInputStream = new DataInputStream(sockClient.getInputStream());
                   BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream("filename.ext"));
                   BufferedReader inputUser   = new BufferedReader(new InputStreamReader(System.in)); //For User input
                   PrintWriter output = new PrintWriter (sockClient.getOutputStream(), true);     //To send the user input to the server
                   //get path from user
                   System.out.print("Enter the complete path of file: ");
                   String path = inputUser.readLine();
                   //send path to server
                   output.println(path);
                   readBytes = dataInputStream.readInt();
                   while(readBytes > 0)
                        readBytes = dataInputStream.read(buffer, 0, readBytes);
                        fileSize = fileSize + readBytes;
                        bufferedOutputStream.write(buffer, 0, readBytes);
                        readBytes = dataInputStream.readInt();
                   }//end while
                   bufferedOutputStream.flush();
                   System.out.println("Received Bytes:  " + fileSize);
                   dataInputStream.close();
                   bufferedOutputStream.close();                              
                   inputUser.close();
                   output.close();
                   sockClient.close();
            }//end try
            catch(IOException ioException)
                 ioException.printStackTrace();
            }//end catch
        }//end main()
    }//end class TransferClient
    *          SERVER            *
    import java.io.*;
    import java.net.*;
    public class TransferServer
        public static void main(String[] args)
             int fileSize = 0;         
             int readBytes = 0;
             final int BUFFER_SIZE = 512;
             byte[] buffer = new byte[BUFFER_SIZE];
             try
                  ServerSocket ss = new ServerSocket(2000);
                  System.out.println("Server Strarts...");
                  Socket sock = ss.accept();
                  BufferedReader clientInput = new BufferedReader(new InputStreamReader (sock.getInputStream()));
                   DataOutputStream dataOutputStream = new DataOutputStream(sock.getOutputStream());
                   PrintWriter output = new PrintWriter(sock.getOutputStream(), true);
                   System.out.println ("Connection Received");          
                   String path = clientInput.readLine();               
                   File f = new File(path);                    
                   if( f.exists() )
                        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(path));               
                        while((readBytes = bufferedInputStream.read(buffer))!= -1)
                             fileSize = fileSize + readBytes;
                             dataOutputStream.writeInt(readBytes);
                             dataOutputStream.write(buffer, 0, readBytes); 
                        }//end while
                        dataOutputStream.writeInt(0);          
                        System.out.println("Sent Bytes:  " + fileSize);
                        bufferedInputStream.close();
                   }//end if
                   clientInput.close();
                   dataOutputStream.close();
             }//end try
             //catch(FileNotFoundException fileNotFoundException)
             //     output.println("Sorry! file does not exist.");
             catch(IOException ioException)
                  ioException.printStackTrace();
             }//end catch       
        }//end main()
    }//end class TransferServer

  • File transfer, read write through sockets in client server programming java

    Hello All, need help again.
    I am trying to create a Client server program, where, the Client first sends a file to Server, on accepting the file, the server generates another file(probably xml), send it to the client as a response, the client read the response xml, parse it and display some data. now I am successful sending the file to the server, but could not figure out how the server can create and send a xml file and send it to the client as response, please help. below are my codes for client and server
    Client side
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.InetAddress;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class XMLSocketC
         public static void main(String[] args) throws IOException
              //Establish a connection to socket
              Socket toServer = null;
              String host = "127.0.0.1";     
              int port = 4444;
              try
                   toServer = new Socket(host, port);
                   } catch (UnknownHostException e) {
                System.err.println("Don't know about host: localhost.");
                System.exit(1);
            } catch (IOException e) {
                System.err.println("Couldn't get I/O for the connection to host.");
                System.exit(1);
              //Send file over Socket
            //===========================================================
            BufferedInputStream fileIn = null;
              BufferedOutputStream out = null;
              // File to be send over the socket.
              File file = new File("c:/xampp/htdocs/thesis/sensorList.php");
              // Checking for the file to be sent.
              if (!file.exists())
                   System.out.println("File doesn't exist");
                   System.exit(0);
              try
                   // InputStream to read the file
                   fileIn = new BufferedInputStream(new FileInputStream(file));
              }catch(IOException eee)
                   System.out.println("Problem, kunne ikke lage fil");
              try
                   InetAddress adressen = InetAddress.getByName(host);
                   try
                        System.out.println("Establishing Socket Connection");
                        // Opening Socket
                        Socket s = new Socket(adressen, port);
                        System.out.println("Socket is clear and available.....");
                        // OutputStream to socket
                        out = new BufferedOutputStream(s.getOutputStream());
                        byte[] buffer = new byte[1024];
                        int numRead;
                        //Checking if bytes available to read to the buffer.
                        while( (numRead = fileIn.read(buffer)) >= 0)
                             // Writes bytes to Output Stream from 0 to total number of bytes
                             out.write(buffer, 0, numRead);
                        // Flush - send file
                        out.flush();
                        // close OutputStream
                        out.close();
                        // close InputStrean
                        fileIn.close();
                   }catch (IOException e)
              }catch(UnknownHostException e)
                   System.err.println(e);
            //===========================================================
            //Retrieve data from Socket.
              //BufferedReader in = new BufferedReader(new InputStreamReader(toServer.getInputStream()));
              DataInputStream in = new DataInputStream(new BufferedInputStream(toServer.getInputStream()));
              //String fromServer;
            //Read from the server and prints.
              //Receive text from server
              FileWriter fr = null;
              String frn = "xxx_response.xml";
              try {
                   fr = new FileWriter(frn);
              } catch (IOException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              try{
                   String line = in.readUTF();                    //.readLine();
                   System.out.println("Text received :" + line);
                   fr.write(line);
              } catch (IOException e){
                   System.out.println("Read failed");
                   System.exit(1);
            in.close();
            toServer.close();
    public class XMLSocketS
          public static void main(String[] args) throws IOException
              //Establish a connection to socket
               ServerSocket serverSocket = null;
                 try {
                     serverSocket = new ServerSocket(4444);
                 } catch (IOException e) {
                     System.err.println("Could not listen on port: 4444.");
                     System.exit(1);
              Socket clientLink = null;
              while (true)
                        try
                             clientLink = serverSocket.accept();
                           System.out.println("Server accepts");
                             BufferedInputStream inn = new BufferedInputStream(clientLink.getInputStream());
                             BufferedOutputStream ut = new BufferedOutputStream(new FileOutputStream(new File("c:/xampp/htdocs/received_from_client.txt")));
                             byte[] buff = new byte[1024];
                             int readMe;
                             while( (readMe = inn.read(buff)) >= 0)
                             {     //reads from input stream, writes the file to disk
                                  ut.write(buff, 0, readMe);
                             // close the link to client
                             clientLink.close();                         
                             // close InputStream
                             inn.close();                         
                             // flush
                             ut.flush();                         
                             // close OutputStream
                             ut.close();     
                             //Sending response to client     
                             //============================================================
                             //============================================================
                             System.out.println("File received");
              }catch(IOException ex)
              {System.out.println("Exception.");}
                        finally
                             try
                                  if (clientLink != null) clientLink.close();
                             }catch(IOException e) {}
                 clientLink.close();
                 //serverSocket.close();
    }

    SERVER
    import java.net.*;
    import java.io.*;
    public class XMLSocketS
          public static void main(String[] args) throws IOException
                   //Establish a connection to socket
               ServerSocket serverSocket = null;
                 try {
                     serverSocket = new ServerSocket(4545);
                 } catch (IOException e) {
                     System.err.println("Could not listen on port: 4444.");
                     System.exit(1);
              Socket clientLink = null;
                  try
                             clientLink = serverSocket.accept();
                         System.out.println("Server accepts the client request.....");
                         BufferedInputStream inn = new BufferedInputStream(clientLink.getInputStream());
                             BufferedOutputStream ut = new BufferedOutputStream(new FileOutputStream(new File("c:/xampp/htdocs/received_from_client.txt")));
                             byte[] buff = new byte[1024];
                             int readMe;
                             while( (readMe = inn.read(buff)) >= 0)
                             {     //reads from input stream, writes the file to disk
                                  ut.write(buff, 0, readMe);
                             ut.flush();                         
                             //Sending response to client     
                             //============================================================
                             BufferedInputStream ftoC = null;
                             BufferedOutputStream outtoC = null;
                             // File to be send over the socket.
                             File file = new File("c:/xampp/htdocs/thesis/user_registration_response.xml");
                             try
                                  // InputStream to read the file
                                   ftoC = new BufferedInputStream(new FileInputStream(file));
                             }catch(IOException eee)
                             {System.out.println("Problem reading file");}
                             // OutputStream to socket
                             outtoC = new BufferedOutputStream(clientLink.getOutputStream());
                             byte[] buffer = new byte[1024];
                             int noRead;
                             //Checking if bytes available to read to the buffer.
                             while( (noRead = ftoC.read(buffer)) >= 0)
                                  // Writes bytes to Output Stream from 0 to total number of bytes
                                  outtoC.write(buffer, 0, noRead);
                             outtoC.flush();
                             //============================================================
                             System.out.println("File received");
              }catch(IOException ex)
              {System.out.println("Exception.");}
                        finally
                             try
                                  if (clientLink != null) clientLink.close();
                             }catch(IOException e) {}
                 clientLink.close();
                 //serverSocket.close();
          }CLIENT SIDE
    import java.io.*;
    import java.net.*;
    public class XMLSocketC
              @SuppressWarnings("deprecation")
              public static void main(String[] args)
                   // Server: "localhost" here. And port to connect is 4545.
                   String host = "127.0.0.1";          
                   int port = 4545;
                   BufferedInputStream fileIn = null;
                   BufferedOutputStream out = null;
                   // File to be send over the socket.
                   File file = new File("c:/xampp/htdocs/thesis/sensorList.xml");
                   try
                        // InputStream to read the file
                        fileIn = new BufferedInputStream(new FileInputStream(file));
                   }catch(IOException eee)
                   {System.out.println("Problem");}
                   try
                             System.out.println("Establishing Socket Connection");
                             // Opening Socket
                             Socket clientSocket = new Socket(host, port);
                             System.out.println("Socket is clear and available.....");
                             // OutputStream to socket
                             out = new BufferedOutputStream(clientSocket.getOutputStream());
                             byte[] buffer = new byte[1024];
                             int numRead;
                             //Checking if bytes available to read to the buffer.
                             while( (numRead = fileIn.read(buffer)) >= 0)
                                  // Writes bytes to Output Stream from 0 to total number of bytes
                                  out.write(buffer, 0, numRead);
                             // Flush - send file
                             out.flush();
                             //=======================================
                             DataInputStream in = new DataInputStream(new BufferedInputStream(clientSocket.getInputStream()));
                             BufferedWriter outf = new BufferedWriter(new FileWriter("c:/xampp/htdocs/received_from_server.txt",true));
                             String str;
                             while(!(str = in.readLine()).equals("EOF")) {     
                                  System.out.println("client : Read line -> <" + str + ">");
                                  outf.write(str);//Write out a string to the file
                                  outf.newLine();//write a new line to the file (for better format)
                                  outf.flush();
                             //=======================================
                             // close OutputStream
                             out.close();
                             // close InputStrean
                             fileIn.close();
                             // close Socket
                             clientSocket.close();
                        }catch (IOException e)
                        {System.out.println("Exception.");}
         Could you please point where am I doing the stupid mistake, client to server is working properly, but the opposite direction is not.
    Thanks

  • Transfering a file through Socket programming

    Hi all,
    I want to return a file from server to client through a socket. I tried using ObjectOutput Stream where in I returned a java.io.File from server. But at client side when I say file.getLeangth() it comes as 0 and if I try to assign FileInputStream on the object it throws an exception as the file not found as the path associated with the file will be of Server.
    So can anyone help as to how to transfer a file through socket programming???
    thx in advance
    MK

    java.io.File is NOT the contents of the file. It really just represents the path.
    If you want to transfer the file's contents, you'll have to use a FileInputStream or FileReader, read from it, and then write the bytes or chars on the wire.

  • Problem in passing byte through socket

    Hi to all,
    I'm trying to pass a byte[] through socket.
    The code where the data is sent is the following:
    byte[] data = new byte[len];
    // read the byte[] from another InputStream
    inStream.read(data, 0, len);
    // carry data to another OutputStream
    handler.out.println("$crypted_obj "+len+" "+pcol_step); //handler.out is a PrintWriter
    handler.incoming.getOutputStream().write(data);
    handler.incoming.getOutputStream().flush();I try to read in this way:
    byte[] data = new byte[len];
    is.read(data, 0, len);When the read is launched for the first time, it return only an array full of zeros, the other times return the right data array.
    I have tried to use BufferedInputStream and BufferedOutputStream but it's the same.
    In debugging mode(Eclipse) all work fine.
    Anyone have a suggestion for solve this problem?
    Thanks in Advice
    Manuel

    But why the sender don't write the bytes?Because the length is wrong, or you have a bug in your sending code which you haven't posted yet.
    Before of the byte[] data I sent a string through a PrintWriter that work on the same OutputStream. The string arrive correctly.Don't use two kinds of streams or Readers or Writers on the same stream. It doesn't work.
    os.write(data); //this is not sent!It is if you flush it.

  • I have a downloaded font file for a school problem on a flash drive and I do not know how to install it into my photoshop application. Need to be walked through this as I am an older user who does not understand any of this stuff.

    I have a downloaded font file for a school problem on a flash drive and I do not know how to install it into my photoshop application. Need to be walked through this as I am an older user who does not understand any of this stuff.

    Fonts are handled by your operating system and installed through the respective System Control panel (Windows) or Fontbook (Mac). On Windows simply type "Fonts" in the search bar in the start menu and when you open the panel/ folder use File --> Add Font. On Mac the procedures are similar, you just need to find the Fontbook app in Applications:Utilities.
    Mylenium

  • Read contents of file into outputstream and send through socket

    I have a file. Instead of transferring the whole file through socket to the destination, I will read the contents from the file (big or small file size) into outputstream and send them to the destination where the client will receive the data and directly display it....
    Can you suggest any efficient way/methods to achieve that?
    Thanks.

    I don' t understand what you think the difference is between those two techniques, but:
    int count;
    byte[] buffer = new byte[16384];
    while ((count = in.read(buffer)) > 0)
      out.write(buffer, 0, count);
    out.close();
    in.close();

  • Problem with file created through GUI_DOWNLOAD

    Hello,
    I have the following code
    REPORT  zprueba.
    START-OF-SELECTION.
      TYPES: BEGIN OF t_type,
        field1(20),
        field2(20),
      END OF t_type.
      DATA: lt_data TYPE STANDARD TABLE OF t_type,
            ls_data TYPE t_type.
      ls_data-field1 = '1'.
      ls_data-field2 = 'UNO'.
      APPEND ls_data TO lt_data.
      CLEAR ls_data.
      ls_data-field1 = '2'.
      ls_data-field2 = 'DOS'.
      APPEND ls_data TO lt_data.
      CLEAR ls_data.
      ls_data-field1 = '3'.
      ls_data-field2 = 'TRES'.
      APPEND ls_data TO lt_data.
      CLEAR ls_data.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *   BIN_FILESIZE                    =
          filename                        = 'C:\Users\jochavez\Desktop\Algo.txt'
       filetype                        = 'DAT'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    *   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *   SHOW_TRANSFER_STATUS            = ABAP_TRUE
    * IMPORTING
    *   FILELENGTH                      =
        TABLES
          data_tab                        = lt_data.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    In one machine the file is like
    1 UNO
    2 DOS
    3 TRES
    In my machine it is
    1 UNO2 DOS 3 TRES
    As you can see all is in one line.
    Both machines are Windows Vista same version, same model (hehe).
    Any idea of why this differente?
    Best Regards

    My problem comes from report CRMD_UI_ROLE_PREPARE
    This report generates a file that can be uploaded to PFCG. When I try to load the file I receive an error message. I saw the file and the generated file has the same problem.
    So I create this test program to see if it is a program error or it is something wrong with my computer.
    The test gave me the same result. NO carriage returns.
    So I need to solve this issue to run again CRMD_UI_ROLE_PREPARE and get a correct file.
    So I think it is configuration of my user or with my computer.
    Any idea?
    Best Regards

  • Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'

    I'm using the pre-installed versions of php and mysql under Mac OS X Server 10.4.4 running on a G4 and am unable to get anything involving mysql to work.
    I ssh to the server and enter various commands in Terminal:
    on typing "mysql" I get
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
    and on typing "mysqladmin version" I get
    mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)'
    Check that mysqld is running and that the socket: '/var/mysql/mysql.sock' exists!
    On typing "sudo mysqld_safe" I get
    Starting mysqld daemon with databases from /var/mysql
    STOPPING server from pid file /var/mysql/MyServer.local.pid
    070722 16:06:05 mysqld ended
    /var/mysql/MyServer.local.err contains
    070722 16:06:04 mysqld started
    070722 16:06:04 [Warning] Setting lowercase_tablenames=2 because file system for /var/mysql/ is case insensitive
    070722 16:06:04 InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    InnoDB: Reading tablespace information from the .ibd files...
    InnoDB: Restoring possible half-written data pages from the doublewrite
    InnoDB: buffer...
    070722 16:06:05 InnoDB: Starting log scan based on checkpoint at
    InnoDB: log sequence number 0 43634.
    /var/mysql has permissions 775.
    The line
    mysql.default_socket = /var/mysql/mysql.sock
    is in /etc/php.ini
    whereis mysqladmin ->
    /usr/bin/mysqladmin
    whereis mysql ->
    /usr/bin/mysql
    ls /var/mysql ->
    MyServer.local.err
    ib_logfile1
    mysql
    ib_logfile0
    ibdata1
    test
    Can't find my.cnf or my.ini anywhere
    Can't find mysql.sock anywhere
    I'm trying to get a bug database running (mantis) under Mac OS X Server 10.4.4 that I can access from local clients.
    I'm trying to follow directions at http://www.mantisbugtracker.com/manual/manual.installation.php
    without knowing anything about mysql or php and I'm stuck on step 3:
    "Next we will create the necessary database tables and a basic configuration
    file."
    I get a message saying
    "Does administrative user have access to the database? ( Lost connection to MySQL server during query )"
    I don't even know if following the mantis directions has resulted in the creation of a database or not. Where would it be?
    Thanks for any help.
    Intel iMac   Mac OS X (10.4.10)  

    I've just done a clean install of OSX Server and added the latest MYSQL packaged installer. Afterwards I found the lock file in /private/tmp/mysql.lock
    The easiest way to solve this problem is to create a symbolic link so that the lock file appears to be in right place.
    e.g.
    cd /var
    sudo mkdir mysql <== this assumes the directory is missing
    cd mysql
    sudo ln -s /private/tmp/mysql.sock mysql.sock
    After this msql commands should work fine, and you've not fiddled with the security settings on users/groups.
    HTH
    Christian

  • Logging through sockets

    Hi
    I'm trying to send logging information through sockets using log4j.
    My configuration file is :
    log4j.rootLogger=Debug, Socket
    log4j.appender.Socket=org.apache.log4j.net.SocketAppender
    log4j.appender.Socket.Port=12345
    log4j.appender.Socket.RemoteHost=localhost
    log4j.appender.Socket.LocationInfo=true
    the server only reads the input string that the logger sends.
    I'm getting this exception on the client side:
    log4j:WARN Detected problem with connection: java.net.SocketException: Software caused connection abort: socket write error
    and this message on the server:
    Server started...
    Client accepted
    ������������org.apache.log4j.spi.LoggingEven�������������

    Ryan,
    I think if I could log to something common like Microsoft Access it would be a help to me in managing database backups and other things, as Citadel is somewhat unique in its format and methods using the Measurement and Automation Explorer. Maybe I could retrieve data from a 3rd party database back into Citadel if Citadel DB becomes corrupted or lost.
    I don't use ODBC logging now, so please excuse me if I come across as lacking in understanding your request. Could the hypertrend or other objects be programmed to log and/or retrieve data to and/or from the 3rd party ODBC database as well?
    Terry Parks, Engineering Analyst
    Terrebonne Parish Consolidated Government (T.P.C.G.)
    Public Works - Pollution Control

  • Connecting to localhost through socket

    Hi Friends
    I want to connect to the localhost (wamp server) and need to read the video file byte by byte through socket please help me to find out the solution.
    Thanks
    Sam

    Turn off your Firewall
    wamp use generally the port 80
    Can you tell more about your problem?

  • Send a message through socket

    Hi
    I want to send a MIMEMessage through socket. And want to receive the same.
    Could any one help me out ?

    Hi
    I proceed that thing.
    I am getting the problem while converting the input stream from socket to MIME message.
    I am getting prob at following line.
      //soc is the object of Socket
      Session session =Session.getDefaultInstance(new Properties(), null);
      MimeMessage l_msg = new MimeMessage(session, soc.getInputStream());When I read the input stream from the file.
    It works successfully. But when I try to get it from socket not doesn't work.
    It's not showing any error also. So I am not able to track the actual error.
    Could you please tell me why it is not working.
    Thanks
    Anmolb

  • ./mysqlshow: Can't connect to local MySQL server through socket '/tmp/mysql

    hi all ,I install mysql on Solaris 10 at first it work fine , but after I restart my PC and go back again I got error on
    ./mysqlshow: Can't connect to local MySQL server through socket '/tmp/mysql
    I google , but still not sure how to deal with it
    Thank you

    I've just done a clean install of OSX Server and added the latest MYSQL packaged installer. Afterwards I found the lock file in /private/tmp/mysql.lock
    The easiest way to solve this problem is to create a symbolic link so that the lock file appears to be in right place.
    e.g.
    cd /var
    sudo mkdir mysql <== this assumes the directory is missing
    cd mysql
    sudo ln -s /private/tmp/mysql.sock mysql.sock
    After this msql commands should work fine, and you've not fiddled with the security settings on users/groups.
    HTH
    Christian

Maybe you are looking for

  • Connection Problem with Facetime on my Macbook Pro

    i have the same problems here .... here is the error report it isnt working on th macbook pro ... all my other products dont have issues ... imac, ipad air, ipad mini, iphone 5s .... PLEASE HELP Process:         FaceTime [2169] Path:            /Appl

  • Pre order $10 Certificat​e & GCU

    Hi, I pre ordered battlefield hardline for the xbox one by depositing $5 the day before the release date. I came back to pick it up the next day and paid I believe a total of $50. I'm not exactly sure if the $5 deposit was applied or not but I don't

  • Cant download explicit? how do i alter this? pls help

    hi, i cant download EXTRAS poscast (4 items) it tryes then stops. no problem downloading anything else. i have notaced that the are explicit but i havnt put any bars on. i have just upgraded to new itunes and this is the first time i have tryed to do

  • Delete SC when req. number ia assigned

    Hi Experts, I am facing a problem. I have created a SC without the vendor is assigned. SRM try to create a Req. but no numberrange has been set up in back-end. In table BBP_PDBEI a Req. number is assigned to the SC, comming from SRM. No Reg. is creat

  • 4 Types of exception and the code to handle them

    Dear all, I would like to know wheter runtime exception, errors exception, unchecked exception and checked exception are classified as the 4 types of exception. What are the java coding of them? please help.