How can i taransfer an image over network through Sockets

If any one have the exsperience for tranfering the image over the network by using socket plz help me immediatly

You have to write a Server application and a Client application.
And connect the Client to the Server.
Then you can send whatever you want in either direction.

Similar Messages

  • Urgent help:send image over network using rmi

    hi all,
    i have few question about send image using rmi.
    1) should i use ByteArrayOutputStream to convert image into byte array before i send over network or just use fileinputstream to convert image into byte array like what i have done as below?
    public class RemoteServerImpl  extends UnicastRemoteObject implements RemoteServer
      public RemoteServerImpl() throws RemoteException
      public byte[] getimage() throws RemoteException
        try{
           // capture the whole screen
           BufferedImage screencapture = new Robot().createScreenCapture(new     Rectangle(Toolkit.getDefaultToolkit().getScreenSize()) );
           // Save as JPEG
           File file = new File("screencapture.jpg");
           ImageIO.write(screencapture, "jpg", file);
            byte[] fileByteContent = null;
           fileByteContent = getImageStream("screencapture.jpg");
           return fileByteContent;
        catch(IOException ex)
      public byte[] getImageStream(String fname) // local method
        String fileName = fname;
        FileInputStream fileInputStream = null;
        byte[] fileByteContent = null;
          try
            int count = 0;
            fileInputStream = new FileInputStream(fileName);  // Obtains input bytes from a file.
            fileByteContent = new byte[fileInputStream.available()]; // Assign size to byte array.
            while (fileInputStream.available()>0)   // Correcting file content bytes, and put them into the byte array.
               fileByteContent[count]=(byte)fileInputStream.read();
               count++;
           catch (IOException fnfe)
         return fileByteContent;           
    }2)if what i done is wrong,can somebody give me guide?else if correct ,then how can i rebuild the image from the byte array and put it in a JLable?i now must use FileOuputStream but how?can anyone answer me or simple code?
    thanks in advance..

    Hi! well a had the same problem sending an image trough RMI.. To solve this i just read the image file into a byte Array and send the array to the client, and then the client creates an imegeIcon from the byte Array containing the image.. Below is the example function ton read the file to a byte Array (on the server) and the function to convert it to a an imageIcon (on the client).
    //      Returns the contents of the file in a byte array.
        public static byte[] getBytesFromFile(File file) throws IOException {
            InputStream is = new FileInputStream(file);
            // Get the size of the file
            long length = file.length();
            // You cannot create an array using a long type.
            // It needs to be an int type.
            // Before converting to an int type, check
            // to ensure that file is not larger than Integer.MAX_VALUE.
            if (length > Integer.MAX_VALUE) {
                // File is too large
            // Create the byte array to hold the data
            byte[] bytes = new byte[(int)length];
            // Read in the bytes
            int offset = 0;
            int numRead = 0;
            while (offset < bytes.length
                   && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
                offset += numRead;
            // Ensure all the bytes have been read in
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "+file.getName());
            // Close the input stream and return bytes
            is.close();
            return bytes;
        }to use this function simply use something like this
    public byte[] getImage(){
    byte[] imageData;
              File file = new File("pic.jpg");
              // Change pic.jpg for the name of your file (duh)
              try{
                   imageData = getBytesFromFile(file);
                   // Send to client via RMI
                            return imageData;
              }catch(IOException ioe){
                           // Handle exception
                           return null; // or whatever you want..
    }and then on the client you could call a function like this
    public ImageIcon getImageFromServer(){
         try{
              // get the image from the RMI server
              byte[] imgBytes = myServerObject.getImage();
              // Create an imageIcon from the Array of bytes
              ImageIcon ii = new ImageIcon(imgBytes);
              return ii;
         }catch(Exception e){
              // Handle some error..
              // If yo get here probably something went wrong with the server
              // like File Not Found or something like that..
              e.printStackTrace();
              return null;
    }Hope it helps you..

  • How can i control what images load on my project to save preload time and avoid loading all images, elements, divs not yet visible?

    Sup buddies,
    How can I control what images load on my project to save preload time and avoid loading all images, elements, divs not yet visible?
    As the project grows in size the load time increases. How does one control not loading all images ,divs,elements etc. until they're
    needed on the timeline? For example some sections are off and only become visible when recalled. My projects slowly grow in size so loading
    all images , is counter productive . My other option would be to create separate htmls but that breaks the seamless user experience .
    TY...Over N Out... 

    hello, kiwi
    quote: "Is there an easy way to burn a completed project to DVD, but keep only the (lo res, lo size) previews on my hard drive?"
    yes.
    maybe,...
    1. you might think of making DVD backups first prior to importing the photos into Aperture. "Store Files: In their current location" once in Aperture make low rez Previews, and export finished Project.
    or,
    2. bring in the photographs to hard drive first prior to importing the photos into Aperture. "Store Files: In their current location" once in Aperture make low rez Previews, and export finished Project.
    the low rez Previews will stay in Aperture but the high quality Versions will be exported onto DVDs and gone from the hard drive (if you delete the originals).
    another way would be to export small about 50-70 pixel wide high quality jpegs to a folder on your Desktop and import & keep these in Aperture Library as a reference. make metadata to show where the original Project DVDs are stored and DVD filing system used.
    victor

  • How can i view nikon images in photoshop? i have cs4 so the camera raw plug-in is not an option and i've lost my disk from the initial purchase of the D90.

    how can i view nikon images in photoshop? i have cs4 so the camera raw plug-in is not an option and i've lost my disk from the initial purchase of the D90.

    The NEF file only gives a little "nef" icon.  i was able to convert the NEF to DNG on the old computer and then brought the files over to the new computer.  On the old computer, the NEF files were depicted as little jpeg's so I would be able to see a picture of what each file represented.  On the new computer, both the NEF files and the DNG files are depicted with icons, "nef" or "dng", but not as little pictures.  On the new computer, though, I am to import the DNG's into Adobe and edit them so that is working regardless of whether or not a picture is present for the icon of each file.  I've downloaded the DNG converter from Adobe and will try the conversion directly on the new computer when I get home from work.  I do appreciate your responses and will let you know how it works.
    I am curious then, since right now the files are represented by little "nef"'s and little "dng"'s: If I also download the viewNX (spelling might be wrong, sorry) from nikon, do you know if that maintains the file as a RAW format file but allows a picture representation of the RAW file for the icon?  (That would make it easier to choose which RAW files I would choose to edit and which to not even bother with as an initial culling if that makes sense.
    Cheers.

  • How can I process Raw Images taken with a Nikon D7000 in PS4  Extended?

    How can I process Raw Images taken with a Nikon D7000 in PSE Extended?

    Hi there
    Unfortunately, CS4 does not support the Nikon D7000. You'll have to download the Adobe DNG converter (links below) to process RAW files from your camera.
    DNG converter 6.3 - Mac
    DNG converter 6.3 - Windows
    Here are some answers to similar questions asked over in the Photoshop General discussion:
    If you need further information on this topic, please feel free to post in the Photoshop General Discussion or in the Camera Raw forum.
    Camera Raw | Supported cameras
    Camera Raw | compatible applications
    Cheers,
    Kendall

  • How can I make an image appear partially in front and partially behind another layer in Adobe Illustrator?

    How can I make an image appear partially in front and partially behind another layer in Adobe Illustrator?

    Put the image behind the layer (at the back of it or on a layer below). With it still selected, Copy.
    Now Paste in Front (Ctrl+F). Depending on your Paste Remembers Layers setting, you may have to bring the newly pasted copy to the front, or to the upper layer.
    Draw a shape over the image to define the portion of it you want to appear "in front."
    With the shape and the image selected, clip the image using the shape. (Object > Clipping Mask > Make)

  • How can I move my left over money from my UAE account into USD for my American itunes account?

    How can I move my left over money from my UAE account into USD for my American itunes account?

    How can I go back to my US account then?? I only have .03 aed left..

  • How can you use one image and edit it three different ways to export later?

    I am a new Lightroom 3 user.  How can use the same image and edit it multiple ways to produce mulitple images to later export?  For example,  I have a picture of a bride and groom.  I want to use that image and create a color image, a black and white image, and a close up of their hands.

    Do I need to do either of those options before I start editing the image at all?  For example,  what if I am working on the image and doing some creative edits.  Then I think of another option that I could do.  Is it too late at that time or can I still get the original image to begin with?

  • I have 528 contacts on my phone, but only 290 on my Icloud how can i move the rest over from my phone to my Icloud nothing is working

    I have 528 contacts on my phone, but only 290 on my Icloud how can i move the rest over from my phone to my Icloud nothing is working

    Go to Settings>iCloud, turn Contacts to Off, choose Delete from My iPhone when prompted (they will still be in iCloud).
    Download the app My Contacts Backup to your phone.  Use this app to backup the remaining contacts on your phone (from your exchange account) as a vCard attachment to an email that you send to yourself.  Confirm that you have received the email on your phone.
    Go to Settings>iCloud and turn Contacts back to On.
    Go to Settings>Mail,Contacts,Calendars>Default Account (in the Contacts section), set this to iCloud.  (This will cause new contacts added to your phone to be added to the iCloud account.)
    Go to Settings>Mail,Contacts,Calendars...tap your exchange account and turn off contacts syncing (otherwise you will end up with duplicates on your phone).
    Open the My Contacts Backup email and tap the attachment to import the contacts from your exchange account back to your phone.  They will be added to iCloud and appear on icloud.com and any other devices syncing contacts with your account.

  • How can I save the images to the iPhone anywhere

    Hello  I own Time capsule 3 tb. How can I save the images to the iPhone anywhere in Time capsule
    note i used fileexplorer when Outside the home isee Outside Message " error connection failed with the error operation time out "
    Thanks

    Most Simple Back Up:
    Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
    Slightly more complex: Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically.
    Example of such apps: Chronosync - but there are many others. Search on MacUpdate or the App Store
    If you want to back up the Photos only:
    Export them using the File -> Export command.
    This User Tip
    https://discussions.apple.com/docs/DOC-4921
    has details of the options in the Export dialogue.

  • When I try to same an image under the command 'save as' it will only let me save as file types 'firefox document' or 'all files' and when I try to look at them later they dont work. How can I save an image as the same file type it is on the web site?!

    When I try to save an image under the command 'save as' it will only let me save as file types 'firefox document' or 'all files' and when I try to look at them later they dont work. How can I save an image as the same file type it is on the web site?!
    == This happened ==
    Every time Firefox opened
    == I updated to one of the firefox versions (Not sure which one it was)

    Thanks Alex, but sadly I already tried that. Neither .docx or .xlsx files show up in the content list. They both show as a Chrome HTML document so changing how Firefox addresses those doesn't help since it thinks its the same type of file. I don't think I can manually add files into the "Content Type" left side nav.

  • I can not join my Apple extreme with the Apple express. I shows a conflict in the network! I've tried everything. How can they join on the same network?

    I can not join my Apple extreme with the Apple express. I shows a conflict in the network! I've tried everything. How can they join on the same network?

    It says that my DHCP has to be changed! How? to what?
    It is 802.11g.express. but is set to default by the computer (Macbook Air).
    The other is 802.11n. (express)
    Extreme is 802.11.g. Is the Main Airport.
    It is on ethernet & wep 128 security.

  • How can I attach an image without the image is in the email body? (using the new mail the Lion)

    How can I attach an image without the image is in the email body? (using the new mail the Lion)
    I want in attachment, not in the body mail.

    I think your only solution is to zip the image files first and then attach them.
    Read this from a site I found:
    Sending Graphical Attachments -- When you attach a graphical image to your message, the recipient of your message sees the image inline (that is, in the body of the message) if her email client supports inline display. ("Take Control of Email with Apple Mail" contains a table listing the capabilities of popular Mac and PC email clients.) If a client does not support inline display (or the recipient has turned off the inline display option), the file appears as an attachment that must be opened in a separate program.
    On the one hand, an inline image is easier for the recipient to see - all she has to do is look at it. On the other hand, inline images can be frustrating to scroll through. If you do not wish to send a graphical image inline, you must compress the file before attaching it - Mail, sadly, lacks a built-in compression option, though fortunately for Panther users, the Finder offers Zip compression without requiring a separate application.
    Note that when you compose a new message, Mail always shows attachments in the body of your message. You can manually drag them somewhere else, but many email clients display all attachments in a separate list, regardless of where you place them in the message body.
    If you paste an image into a message or drag & drop an image from another window (say, a Web browser), Mail converts the raw image data to an attachment in TIFF format. On the other hand, if you drag & drop the icon of an image file (or use the Attach button to locate the file using the file browser), Mail leaves the attached image in its original format. This difference is significant, because although most email clients can display JPEG images just fine, support for TIFF - especially in non-Mac email clients - is less common. If possible, I suggest attaching image files as opposed to pasting or dragging in raw image data.

  • How can I set up a new network on my apple tv when my remote app isn't picking it up because they aren't on the same network?

    How can I set up a new network on my apple tv when my remote app isn't picking it up because they aren't on the same network? The actual remote doesn't work anymore, so I've been using the remote app on my phone but now that our internet changed, I can't do anything at all. Please help!

    You can't use the remote app to setup a network. If your physical remote isn't working you will need borrow another or purchase a replacement.

  • How can we get the image which is stored in clipboard by labview, is there any functions available like text from clip board

    How can we get the image which is stored in clipboard by labview, i can get the text in clipboard by using invoke node directly.but i cannot get the image, is there any functions or vi available.(image is in Png format)

    The Read from Clipboard method is, unfortunately, limited to text. If the clipboard contains an image then you need to use OS-specific functions calls. This is an example program for Windows. It's old, but it should still work.

Maybe you are looking for

  • Client Security Solution And System Key Recovery

    Hey, I have an IBM ThinkPad T40 2373-82M Laptop. Everytime Windows starts up Client Security Solution displays a box which is prompting me to enter a password of some sort for authentication. It indicates at the top of the window that the reason for

  • Transfering iPhoto to Another Computer

    I need to transfer my entire iPhoto application file to my Macbook Pro. My other computer that the iPhoto is on is a G4 Quicksilver with OS 10.3.9. I believe that this can be done using the Firewire, right? Thanks to who replies! Kevin

  • Change Default Screen Capture Format from PNG to JPG

    I'm running Mac OS 10.4.8 on a G5 Duo Core (Power PC). Up until about 10.4.1, my screen captures (Apple-Shift-4) would result in a PDF file. Then they started coming out as PNG files. I would strongly prefer that they default to jpg files, since I ty

  • Am I missing something installing Mavericks?

    I have a mid-2009 macbook pro running mountain lion with 8gb Ram which looks like the required spec to install mavericks. I replaced the hd with a SSD (480gb named 'SSD') recently which I think maybe the problem but I'm not sure. It's now the only dr

  • How to add a group to mail stationery

    I have been using stationery for a group and sending out reminders every week but after this last update, The names I highlight will not stay in the box when I drag them up.  What is changed?