Transfering image, sound and text from server to client

I implemented a client and a server and right now it is only implemented that it transfers only plain .txt documents only. Now I want to alter it to transfer everything.
I was thinking about reading the data and then create a new file in the client and copies that data with the same extension as the one read from. Though I tried it out for an image and I wasnt allowed to do so since FileOutputStream can't read an image.
Can please someone give me some ideas what shall I do in order to be allowed to transfer everything?
thanks very much

to read only text file I had the following code
  kkSocket = new Socket(host, 4444);
             out = new PrintWriter(kkSocket.getOutputStream(), true);
            BufferedReader in = new BufferedReader(new InputStreamReader(kkSocket.getInputStream()));
            // read parameters
            String[] params = in.readLine().split(",");
            Integer noOfBlocks = Integer.parseInt(params[0]);
            Integer blockSize = Integer.parseInt(params[1]);
            Integer lastBlockSize = Integer.parseInt(params[2]);
            String inputLine = "";
            for (int i = 0; i < noOfBlocks - 1; i++) {
                // read blockSize bytes
                inputLine += readBlock(blockSize, in);
            // read lastBlockSize bytes
            inputLine += readBlock(lastBlockSize, in);
            System.out.println(inputLine);The above code displays it only on console.. Now I added the following code in order to be saved in a file:
File x;
            x= new File("C:\\newfile.jpeg");
            x.createNewFile();
            FileOutputStream fop = new FileOutputStream(x);
            fop.write(inputLine.getBytes());
            fop.close();When I added the last snippet of code I am having these errrors:
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at client.ClientMain.main(ClientMain.java:29)
Couldn't get I/O for the connection to: localhost
Java Result: 1

Similar Messages

  • Share Image,Link and Text to Social Networking App from My Windows Phone App

    Hi,
    I am developing windows phone 8.1 silverlight app where I want to share Images,Links and text to Social Networking App Like Facebook,Twitter,Whatsapp and Instragram.
    In Share content contains A Image of App Icon, A Link of App website and I invitation Text.
    There are Five buttons
    Share by Email
    Share by Facebook
    Share by Twitter
    Share by Whatsapp
    Share by Instragram
    Problems which I faced
    I can not attached image to Email. How it is Possible.?
    I can only open whatsapp from my App. But can not share to this
    I have used Share task but in list of app there is no whatsapp and instragram app ( I know there is no official app for instragram but it is Instragram Beta app)
    Please guide me how can I share my content to all above app

    Please see this sample application:
    https://code.msdn.microsoft.com/windowsapps/Sharing-Content-Source-App-d9bffd84
    You cannot control what appears in the share UI.  The Share UI Will show all applications that have registered to receive the type of content you are sharing.  So if a particular application is not appearing, then it is not registered as a Share
    target for that content type.
    I would run the sample on your phone for the various content types.  it should give you a good idea of which apps are registered for which content type.
    Bret Bentzinger (MSFT) @awehellyeah

  • How to place two different indesign documents side by side on my desktop in order to copy and paste images and text from one to the other?

    How to place two different indesign documents side by side on my desktop in order to copy and paste images and text from one to the other?

    Or choose Window > Arrange > Tile
    And, you of course can copy/paste without tiling.

  • My phone has been smashed I need to get records of all my iMessages and texts from the last month. How do I get these?

    My phone has been smashed I need to get records of all my iMessages and texts from the last month. How do I get these?

    Do you have a backup of your iPhone which contains these messages?
    If so, you can restore a new iPhone from that backup during setup.
    If not, the messages are gone.

  • Need to make a 20 second HD clip with a moving image background and text thats flies in...

    Hi all im quite new to after effects and need to make a 20 second HD clip with a moving image background and text thats flies in. I also need to create a basic cross image. If anyone could suggest the best way to go about doing this it would be greatly appreciated. Thank you in advance

    Thank you for both of your reponses and I will try and be clearer:
    what I want to acheive is a HD motion graphic of text which will almost spin onto the screen letter my letter and then a become static word. Behind this I would like to place a moving image clip.
    By 'basic cross image' what im looking to do is use a cruifix shape instead of a 't' on the text.
    I hope this makes sense and thanks again!

  • I bought a new computer running Lion 10.7.3 and transferred my applications and files from my old Mac using migration assistant but I can't find/transfer my photos from iPhoto and I can't find my old documents such as previous tax returns.

    I bought a new computer running Lion 10.7.3 and transferred my applications and files from my old Mac using migration assistant but I can't find/transfer my photos from iPhoto and I can't find my old documents such as previous tax returns.

    Look for them on your old computer, when found copy the files to a USB drive and move them to the new computer.

  • HT201320 Once I have downloaded email on my iPad the same is not downloaded on my laptop. Have tried all settings including choosing the setting DELETE FROM SERVER:NEVER and REMOVE FROM SERVER:NEVER

    Once I have downloaded email on my iPad the same is not downloaded on my laptop. Have tried all settings including choosing the setting DELETE FROM SERVER:NEVER and REMOVE FROM SERVER:NEVER

    Hey rbrylawski, just wanted to let you know that my ipad email problems have been solved. Called Apple Sup in OZ, I'm in NZ. Daniel Barber was the support tech from heaven!! I was about to return the ipad but solving this issue reset my faith in phone support.....perhaps until I call a differnet companys phone support eh? Anyhow, for reference the fix is below.  My accounts are all POP not IMAP, and the primary smtp server setting had defaulted to have SSL switched on and the port was set to 5XX (something, cant remember). Anyhow, SSL was switched off and the port was swithced to 25. VOILÀ!!  Settings/Mail, contacts, calendars/My POP mail account/smtp/primary server/ >>> server on, no username and password,  use SSL off,  no authentication,  Server Port 25  Thanks for having a crack at it. This might help when assisting another user. Cheers Tonino

  • How can i transfer more than one file from server to client

    Hi,
    our requirement is transfer more than one files from server to client using the
    webutil_file_transfer.as_to_client_with_progress.One file transfer is already working in our system.If anybody know the solution please inform
    regards
    mat

    just an idea ...
    for this purpose let us put aside security concerns and other potential problems....
    -- Get the content of a server directory with Filter and create zip file
    1) create a class that implements java.io.FilenameFilter ...
    2) define accept() method ...
    3) call File.list() with the filter as a parameter. The returned array of strings will have all the names that passed through the accept() filter
    4) use java.util.Zip to create ZIP file on the server side
    -- I think it is better to create this functionality as a separate Java class, put it in required folder and after it
    -- use Forms->Program->"Import Java class" to create pl/sql wrappers, than to create wrappers for all classes and code in pl/sql
    5) use webutil to transfer file on the client
    6) use Java on client side to unzip transferred file
    if you think this is not too complicated, you should try ...
    Regards,
    Vladimir

  • VTP from server to client mode

    Hi,
    I have couple switches setup in VTP server mode. All of them have the same VTP revision number, but most of them should be in VTP client mode.
    Will switching some of them (but the one I really want to have in VTP server mode) into VTP client mode have negative impact on the network? I do know that if you change a switch (with the highest rev #) from client mode to server mode I could end up with problems. However, in my case it will be switching them from server to client mode with all of them with the same Rev #.
    Thanks for the help

    Hello,
    change the switches in question to VTP transparent mode first, and then to client mode, that will reset the revision and prevent any possible conflicts.
    In addition, in case you need to change the root switch as well, in general the VTP server switch should also be the root for your VLANs. You can set the switch as root by configuring it as:
    spanning-tree vlan x priority 0
    HTH,
    GP

  • Move files from server to client

    I have create txt file in server directory using UTL_FILE package,
    and I put in the directory in server.
    Server platform is linux. and client platform in Windows.
    What I want to ask is there any possibilities to copy that file from server to client using pl/sql ? could all of you "The Gurus" give me a script example ?
    Thanks a lot.
    regards,
    indra

    > What I want to ask is there any possibilities to copy that file from server
    to client using pl/sql
    No. Not really.
    Think about it.. the file is on the server. PL/SQL code executes inside the Oracle server session that is servicing the client.
    Just how is PL/SQL (on the server) suppose to reach out and push that file to a client's file system and directory?
    PL/SQL cannot do this. You need something on the client that will accept the file. You need something in-between the client and PL/SQL that will handle the transfer of the file. This something can be ftp, scp, tftp, NetBIOS etc.
    Anyway you look at this, it does not make sense. You are turning the server into the client that needs to push the file. You are turning the client into a server that needs to accept the file.
    Why? This is contrary to the basic client-server RDBMS architecture. You are adding more complexities and more moving parts to the architecture by forcing a swap of client and server roles. The are now a far greater likelihood of errors and bugs and failures.
    It does not make sense to do it this way.
    What is the business requirement you are trying to satisfy? Instead of us trying to help you to hack a flawed solution, let us rather assist you in determining the correct and proper solution.

  • Image: display from local drive, upload to server file system, and display from server

    Hello,
    I am using jdev 11.1.2.4.0...
    The requirement is that users would like to upload images from their local drive to server drive and they would like display images from server drive later.
    We don't want to keep images in database. I am not sure what the solution should be; however, I plan to ....
    1. create a table to keep an information of images -- image_id, image_location (server drive), image_filename
    2. create a page where users can enter image information and specific filename from a local drive (I think I will use inputFile component) and provide the preview button to display an image on screen before save it. To save data is to save information to the database and copy an image file to the server drive (the destination location for image files is predefined.)
    3. create another page where users can browse information from the database and display an image for a selected record by getting from the server.
    I need suggestions on...
    1. how to display an image on page from the local drive?
    2. how to copy a file from a local drive to a server?
    3. how to display an image on page from the server drive?
    Thank you.
    nat

    See:
    http://tompeez.wordpress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-1/
    http://tompeez.wordpress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-2/
    http://tompeez.wordpress.com/2011/12/16/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-3/
    Where Timo saves images to the database, you save it to the file system (examples on how to do this from Java are available plenty if you just Google for it). Similar to Timo you then use the image tag to display images. The difference is that you can directly add the URL from the database table.
    The benefit of using a database to host images is that you are not dependent on file server structures though
    Frank

  • Reading text from server socket stream

    I have a basic cd input program i've been trying to figure out the following problem for a while now, the user enters the artist and title etc and then a DOM (XML) file is created in memory this is then sent to the server. The server then echos back the results which is later printed on a html page by reading the replys from the server line by line.
    The server must be run it listens for clients connecting the clients connect and send DOM documents through the following jsp code.
    <%@page import="java.io.*"%>
    <%@page import="java.net.*"%>
    <%@page import="javax.xml.parsers.*"%>
    <%@page import="org.w3c.dom.*"%>
    <%@page import="org.apache.xml.serialize.*"%>
    <%!
       public static final String serverHost = "cdserver";
       public static final int serverPort = 10151;
    %>
    <hr />
    <pre>
    <%
            Socket mySocket = null;          // socket object
            PrintWriter sockOut = null;      // to send data to the socket
            BufferedReader sockIn = null;    // to receive data from the socket
            try {
                //  #1 add line that creates a client socket
                mySocket = new Socket(serverHost, serverPort);
                // #2 add lines that create input and output streams
                //            attached to the socket you just created
                 sockOut = new PrintWriter(mySocket.getOutputStream(), true);
                 sockIn = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));
            } catch (UnknownHostException e) {
                throw e; // This time the JSP can handle the exception, not us
            } catch (IOException e) {
                throw e; // This time the JSP can handle the exception, not us
    String cdTitle, cdArtist, track1Title, track1Time, track1Rating;
    // Retrieve the HTML form field values
    cdTitle = request.getParameter("cdtitle");
    cdArtist = request.getParameter("cdartist");
    track1Title = request.getParameter("track1title");
    track1Time = request.getParameter("track1time");
    track1Rating = request.getParameter("track1rating");
    // Create a new DOM factory, and from that a new DOM builder object
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    // Note that we are creating a new (empty) document
    Document document = builder.newDocument();
    // The root element of our document wil be <cd>
    // It gets stored as the child node of the whole document (it is the root)
    Element rootElement = document.createElement("cd");
    document.appendChild(rootElement);
    // Create an element for the CD title called <title>
    Element cdTitleElement = document.createElement("title");
    // Add a text code under the <title> element with the value that
    // the user entered into the title field of the web form (cdTitle)
    cdTitleElement.appendChild(document.createTextNode(cdTitle));
    // Place the <title> element underneath the <cd> element in the tree
    rootElement.appendChild(cdTitleElement);
    // Create an <artist> element with the form data, place underneath <cd>
    Element cdArtistElement = document.createElement("artist");
    cdArtistElement.appendChild(document.createTextNode(cdArtist));
    rootElement.appendChild(cdArtistElement);
    // Create a <tracklist> element and place it underneath <cd> in the tree
    // Note that it has no text node associated with it (it not a leaf node)
    Element trackListElement = document.createElement("tracklist");
    rootElement.appendChild(trackListElement);
    // In this example we only have one track, so it is not necessary to
    // use a loop (in fact it is quite silly)
    // But the code below is included to demonstrate how you could loop
    // through and add a set of different tracks one by one if you
    // needed to (although you would need to have the track data already
    // stored in an array or a java.util.Vector or similar
    int numTracks = 1;
    for (int i=0; i<numTracks; i++) {
      String trackNum = Integer.toString(i+1);
      Element trackElement = document.createElement("track");
      trackElement.setAttribute("id", trackNum);
      trackListElement.appendChild(trackElement);
      // Track title element called <title>, placed underneath <track>
      Element trackTitleElement = document.createElement("title");
      trackTitleElement.appendChild(document.createTextNode(track1Title));
      trackElement.appendChild(trackTitleElement);
      // Track time element called <time>, placed underneath <track>
      Element trackTimeElement = document.createElement("time");
      trackTimeElement.appendChild(document.createTextNode(track1Time));
      trackElement.appendChild(trackTimeElement);
      // Track rating element called <rating>, placed underneath <track>
      Element trackRatingElement = document.createElement("rating");
      trackRatingElement.appendChild(document.createTextNode(track1Rating));
      trackElement.appendChild(trackRatingElement);
    OutputFormat format = new OutputFormat();
    format.setIndenting(true);
    // Create a new XMLSerializer that will be used to write out the XML
    // This time we will serialize it to the socket
    // #3 change this line so that it serializes to the socket,
    // not to the "out" object
    XMLSerializer serializer = new XMLSerializer(writer, format);
    serializer.serialize(document);
            // Print out a message to indicate the end of the data, and
            // flush the stream so all the data gets sent now
            sockOut.println("<!--QUIT-->");
            sockOut.flush();
            BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
            String fromServer;
            String fromUser;
             #4 add a while loop that reads text from the
            server socket input stream, line by line, and prints
            it out to the web page, using out.println(...);
            Note that because the reply from the server will contain
            XML, you will need to call upon the toHTMLString() method
            defined below to escape the < and > symbols so that they
            will display correctly in the web browser.
            Also note that as you receive the reply back from the
            server, you should look out for the special <!--QUIT-->
            string that will indicate when there is no more data
            to receive.
            while ((fromServer = sockIn.readLine()) != null) {
            out.println(sockIn.readLine());
                // If the reply from the server said "QUIT", exit from the
                // while loop by using a break statement.
                if (fromServer.equals("QUIT")) {
                    out.println("Connection closed - good bye ...");
                // Print the text from the server out to the user's screen
                out.println("Reply from Server: " + fromServer);
                // Now read a line of text from the keyboard (typed by user)
                fromUser = stdIn.readLine();
                // If it wasn't null, print it out to the screen, and also
                // print a copy of it out to the socket
                if (fromUser != null) {
                    out.println("Client: " + fromUser);
                    sockOut.println(fromUser);
            // Close all the streams we have open, and then close the socket
            sockOut.close();
            sockIn.close();
            mySocket.close();
    %>
    I'm suppose to modify the commented sections labled with #.
    #1,2 are correct but i have doubts on the 3rd and 4th modification.
    for #3 i changed so i serializes to the socket not to the "out" object:
    from
    XMLSerializer serializer = new XMLSerializer(out, format);
    to
    XMLSerializer serializer = new XMLSerializer(writer, format);
    with "out" it prints out some of the results entered but it just hangs i'm thinking it might be the while loop that i added in #4. If i changed it to serialize the socket XMLSerializer serializer = new XMLSerializer(writer, format); it doesn't print out nothing at all; just a blank screen where it hangs.
    I can post the rest of the code (server thats in java and cdinput.html) but since i want to keep my post short and if required i'll post it later on i also omitted some of the code where it creates the DOM textnodes etc to keep my post short.

    On your previous thread, why did you say the server was using http POST and application/xml content type when it quite obviously isn't, but a direct socket communication that abuses XML comments for message end delimiters?
    The comments imply you need to wait for "<!--QUIT-->" on a line by itself, but your loop is waiting for "QUIT".
    Pete

  • How do i turn off sound and text notifications?

    I find both the text and sound notifications very annoying. I do not play games or do anything other than work on this computer. When I unchecked the "show a notification" and "play a sound" boxes, the notifications and sounds do not turn off. I also prepared a 5 second sound file of silence and checked the "Play a Sound" and "use the following sound" boxes with the name of the silence in the required field. Nothing has worked. I don't like being disturbed when I work. I have done the checking and unchecking before restarting and also starting the computer up after a complete shut down.

    If you unchecked the option in Thunderbird then I doubt that is where the notification is coming from. MACs are notorious for supplying an additional notification. I would check your operating system for the source of the notification.

  • How to delete email from iPhone ONLY and not from server?

    Hi. I have a Yahoo! POP mail account.. Can anyone advise me how to setup my iPhone so it ONLY deletes email from the iPhone and NOT the server. So, after I read an email on the iPhone and delete it, the email remains in the INBOX on the server? If not, I will send a feedback to Apple. BTW - I can dl and send email just fine. Thank you.

    ampullae,
    When you setup Yahoo on the iPhone it defaults to IMAP because Yahoo offers free IMAP Push for iPhone users, as discussed in this article:
    http://docs.info.apple.com/article.html?artnum=305882
    If you add your Yahoo account as "other" it will be setup as POP.
    With IMAP messages are stored on the server, and messages created in one email client, such as the iPhone, show up in the sent mailbox on both. In addition messages moved to a different folder on the iPhone, will be in a different folder when you access your Yahoo mail via a web browser or another IMAP client. Likewise message you delete, will also be synchronized and deleted.
    Hope this helps,
    Nathan C.

  • High bill with unusual calls and texts from non-functioning numbers?

    We have a family share plan with 3 phones, one phone for my husband and two phones for our employees.  Our usual phone bill runs around $150.  Our last bill was over $600, the majority charges being on one of our employee's lines.  This particular employee has been with us for over 10 years, and has always been extremely trustworthy and very frugal in his usage of his phone to make personal calls (very infrequent and always less than 5 minutes in duration, unless made during the free nights and weekends timeframe).  Our latest bill showed over 1,000 texts to/from his phone, as well as over 3,000 peak calling minutes (both to/from his phone) alone.  Many of the peak calls are lengthy in duration (30+ minutes, up to 120 minutes).  I realize this post is long, so will divide it into headings so that it makes more sense:
    Information on usage:
    Our employee insists that he did not make these calls and texts (he does not even know how to text), and what is odd about the numbers that appear on the detail (both text and voice) is that they fit into one of two categories:
    1.  There are calls to two particular non-local area code numbers (and possibly bogus, as they have area codes 523 and 352(?)).  When I call the two numbers, I get the following messages:
    From my landline:  When called from my landline, adding a "1" before the 10 digit number, I get the recording stating that "your number cannot be completed as dialed, please check the number and dial again"
    From a cell number- When calling from my own VZW phone (on separate account from husband's), I get a VZW message that the number "has been changed, disconnected or is no longer in service"
    2. They are local area code numbers, but when I call the number, I get a recording asking me to enter my pin number (in other words, they are numbers that cannot receive incoming calls, but according to our bill, have not only made calls to our employee's phone, but also received calls.  I have done an online lookup on these numbers and they are all cell phones.
    3.  When I have tried to text the non-local numbers from my VZW phone, I get messages back stating that these are landline numbers and cannot be texted; when I text the local numbers, I have texted a generic message along the lines of "I can't reach you on the phone.  Please call me as soon as you can" but I do not receive a call back.
    We cannot speak directly with our employee right now (he is in Mexico to pick up his elderly grandmother),  nor can we access our employee's phone to check the log, call history, etc. because he has the phone with him.  Due to this, when we discovered the high usage, we immediately "suspended" the phone line so that no calls could be made or received.  Subsequent to suspending the line, we have talked to his family a couple of times -- one time he happened to call them on another line, so we talked to him "indirectly" through a family member on another line with him.  He was alarmed about the calls and insists he did not make them. 
    He does have children but they are forbidden (by him) from using the phone, and he states that he always keeps the phone in a case on his hip, thus no one else has access to the phone.  To go even further, it seems that most all of the calls to these unusual numbers are made on weekdays, during school hours, so I feel sure the calls were not made by his kids.
    Calls to Verizon:  When we first called Verizon, they suggested we suspend the phone until we could speak to our employee.  Subsequent to our indirect conversation with him mentioned above, we called them back and told them he stated that he did not make the calls nor send the texts, and that we believed the phone might have been compromised, cloned, hijacked or whatever.  First, the customer svc rep looked at our account and suggested that we put an unlimited text on the phone for the current unbilled usage (there were a lot of texts, and we have no text plan on the employee's phone), and then remove that plan once we get to the bottom of this matter. 
    Due to our concern about fraudulent usage, the customer svc. rep called the fraud dept. while my husband was holding on the line.  She came back on the line and told my husband that the fraud dept. said that "it cannot be fraud because if it was, there would be thousands of dollars in international long distance to countries like Pakistan and India." (WTH?)  Also, she said that it couldn't be fraud "because texts were sent to and from the telephone number so we know it was your phone."  (another WTH?)
    She then went on to say that it looks like texts were sent to international numbers (???) recently (these same 523 and 352 area code numbers I referred to above).  Number one, if these were international texts, it seems odd to me that these texts show up on our billed and unbilled activity as "domestic text" and there is no premium charge assessed to our account for international texts.  Number two, if these numbers were international numbers, I imagine that we would be charged for outgoing international calls, which we were not.  Further, I imagine that the numbers would be displayed on our bill in other than a ten digit format, but am not sure, as no one has ever made an international call or text on our phone.
    Next steps:
    Does anyone have advice for the next steps we should take and how we can get to someone in customer service who can actually help us with this problem, instead of what we experienced on our previous call?  Can we demand that Verizon launch an investigation through its fraud department on the activity on this phone, or is this at the discretion of VZW to launch an investigation?  I am unsure, since this was not given as an option by the customer service rep... 
    If we can get Verizon to launch an investigation, is payment of the portion of the bill with the unusual and disputed usage (namely, that which is over and above the usual usage) waived pending the investigation results, or will we have to pay the entire bill to both avoid having the phones turned off, as well as any detrimental effects to our credit?  We've been hit hard by the economy, both personally (I am out of work right now) and business wise (my husband's business has been doing only about 25% of its usual business), and we don't have the extra $$ for the bill unless we take it out of our grocery budget. 
    If anyone has any insight, suggestions or otherwise, I sure would appreciate it.  Sorry for the lengthy first post, but I thought it would be helpful to outline as much about the situation as I could in order that people could respond.  Thanks in advance!

    kbinga,
    I know this is a confusing and frustrating situation for you. I would be happy to review the account in detail to see what is happening with the usage and charges to ensure it does not continue to be a problem for you. Please send me a direct message for further support assistance.
    Thank you!
    AdamE_VZW
    Follow us at @VZWSupport

Maybe you are looking for