Problems sending bufferedimages through a socket

Hi everyone,
I've got a server program that takes a screen capture as a bufferedimage, and sends it through a socket to be saved by the client program. The programs work fine, however, whenever I'm transferring the image with the code at the bottom of this post, I notice that the collision LED on my network hub flashes and I can't figure out why (Obviously there's a collision, but I don't know what causes it or how to stop it from happening). I've googled a bit for collisions and bufferedimages, but have come up with El Zilcho. I've also gone through the IO tutorial and the Socket and BufferedImage API's, but havent learned anything to solve my problem.
Also, As it is now, if I want multiple images, I need to disconnect and reconnect repeatedly. I tried sending multiple bufferedimages throught the socket, but get the following exception:
java.lang.illegalargumentexception:  im == null!Does anyone know of a way where I can send multiple bufferedimages through the socket without reconnecting every single time? Thanks
Server code:
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
Rectangle screenRect = new Rectangle(screenSize);
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture(screenRect));
ImageIO.write(image, "jpeg", fromClient.getOutputStream());
fromclient.shutdownOutput();
fromclient.close();Client code:
BufferedImage receivedImage = ImageIO.read(toServer.getInputStream)
toServer.close();Any help would be greatly appreciated. TIA
Jay

Have you tried.
ImageIO.write(image1, "jpeg", fromClient.getOutputStream());
ImageIO.write(image2, "jpeg", fromClient.getOutputStream());
ImageIO.write(image3, "jpeg", fromClient.getOutputStream());
ImageIO.write(image4, "jpeg", fromClient.getOutputStream());
ImageIO.write(image5, "jpeg", fromClient.getOutputStream());
ImageIO.write(image6, "jpeg", fromClient.getOutputStream());
ImageIO.write(image7, "jpeg", fromClient.getOutputStream());

Similar Messages

  • Problems sending pictures through BBM

    Device info
    Your carrier: SaskTel
    Model info and OS version: Tour 9630 v5.0.0.419
    Apps and free space
    File free before and after: 50725263 Bytes Before; 78361895 Bytes After
    Did a battery pull fix your issue? NO
    Apps installed and their version if possible:
    Third Party
    Blocked Traffic Free 2.3
    FourSquare 1.9.9
    Imagining Theme 2.0
    Media Player 1.0.5
    MySask411 1.2
    Pixelated 2.4
    ScoreMobile for BlackBerry 1.7
    WeatherEye 2.0.2.6
    Add-on
    BlackBerry App World 2.0.1.12
    BlackBerry Application Centre 5.0.0
    BlackBerry Maps 5.0.0
    BlackBerry Messenger 5.0.0
    BrickBreaker 5.0.0
    Documents To Go 1.008.012
    eBay 1.0.3.5
    Help 5.0.0
    Klondike 1.4.8
    MemoPad 5.0.0
    Password Keeper 5.0.0
    Sudoku 1.0.11
    Tasks 5.0.0
    Texas Hold'Em King 2 2.3.0
    Word Mole 5.0.0
    Question
    I have recently tried sending pictures through BBM to other contacts with various BlackBerry devices. There seems to be a problem when trying to send pictures that I have saved on my memory card (Lexar 8GB MicroSD) that have been sourced from the internet (via the Mobile Browser). The pictures have been saved from websites such as wikipedia and facebook and I haven't been able to send any of the pictures over BBM. I also tried saving other pictures from the internet to my computer and transferring them onto my memory card with a USB cord and then trying to send the pictures with BBM; same result: they would not send. 
    There are two processes I have followed and they are detailed below:
    1) Through BBM Chat Window
    - Conversation window with contact is open
    - Hit Menu Key > Send Picture
    - Picture Selected
    - Set Caption window displayed, caption selected. Press Send
    - Select Image Size window displayed
    - Image Size selected (I've tried selecting different image sizes with no change in result)
    - Press OK
    - Nothing happens, screen returns normal. No loading sign, nothing. Its like nothing ever happened
    2) Through Media Browser
    - Picture Selected in Browser
    - Hit Menu Key > Send or Share > Send to Messenger Contact
    - Dialogue Box appears: "Send File 'file name here' to Contact Name"
    - Select OK
    - Select Image Size window displayed
    - Image Size Selected (I've tried selecting different image sizes with no change in result)
    - Press OK
    - Nothing happens, screen returns normal. No loading sign, nothing. Its like nothing ever happened
    Also this ONLY happens when I'm trying to send pictures that have been saved from the internet (through mobile browser). Pictures that I have taken with the camera have always sent to contacts fine, please note that pictures from the camera are saved to the same memory card (Lexar 4GB MicroSD).
    If you can provide any insight to this recurring problem, or need more explanation/information, please reply!
    Thanks,
    Stefan

    taniabergh wrote:
    It gives me an error that says "Upload failed: Jsonexeption: Jsonobject text must begin with '{' at character 1 of http/1.1 501 not implemented Connection: close server: Whatsapp-mms/2 content-length: 41 Content-type: text/html."
    I've never seen that error before. I suggest you do a backup first, Ensure the BlackBerry smartphone is running the most current version of BlackBerry Device Software. For more information on updating the BlackBerry Device Software, see KB16068.
    Click if you want to Thank someone. If Problem is resolved, so that others can make use of it.

  • Send ArrayList through UDP socket

    I have the following 2D ArrayList
    ArrayList<ArrayList<Integer>> myList = new ArrayList<ArrayList<Integer>>();How is it possible to send it through a UDP socket and then get it back?

    Apart from adding implenents Serializable after the class name what else i have to do in order to add the arraylist to the datagramSocket?
    For simple sockets i have found this
    http://java.sun.com/developer/technicalArticles/ALT/sockets/ but
    but it doesn't work for DatagramSocket
    ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream()); throws an error "The method getOutputStream() is undefined for the type DatagramSocket"
    Edit: It seems this site has the solution
    http://www.nada.kth.se/~bishop/resources/javaSerial/index.html
    Message was edited by:
    [email protected]

  • Problem sending email through iCloud

    For the past 3 days I have not been able to send email through MAIL on my mac. I contacted Apple and they said they are working on it. I noticed this morning that my whole address book had been duplicated. Is anyone else experiencing similair issues?

    Hi kezart,
    Thanks for using Apple Support Communities.  Try rebuilding the mailboxes and see if that helps:
    Mail (Mavericks): Rebuild mailboxes
    http://support.apple.com/kb/PH14958
    Cheers,
    - Ari

  • Having problem sending mail through iMAC to PC outlook express.

    i have iMAC MAC OS X 10.3.9 and using mail to send/receive messages.
    I m having problem sending messages to outlook Users as when i send any message to them with different font colors so they receive message but in all Black color,and while when i send the same message with different Font color to Mac users so they receive same message which i sent with different Font color.
    In both conditions my message in sent item shows all colors which i have done but outlook users do receive message but with all Black color. Plz give me an opinion to solve this problem.

    If you are accessing your Comcast POP account with Outlook Express on your Windows PC, create your .Mac account as an IMAP account with OE.
    Create a .Mac server stored mailbox for Comcast received messages and another for Comcast sent messages.
    Copy the messages from the Comast Inbox and Sent mailbox to the designated server stored .Mac mailboxes.
    After doing so, when launching the Mail.app on your Mac, these server stored mailboxes created with OE on your Windows PC and the transferred messages will be available.
    Create two "On My Mac" location mailboxes - one for the transferred Inbox messages and one for the transferred sent messages. Transfer the messages from the server stored mailboxes to these "On My Mac" location mailboxes. This process will store the messages locally on the hard drive and remove the messages from the server at the same time.

  • Slowness problem sending traffic through CX module

    People in the remote site access a SharePoint site via HTTP with Internet Explorer and open Microsoft documents. When I configure the ASA to send HTTP traffic through the CX module it slows opening documents to a crawl (Over 5 minutes to open) but everything else works fine. When I don’t send traffic through the CX module the documents open quickly (seconds) with no issue. So what I need to do is HTTP traffic going to and from the remote site needs to bypass the CX module or set it up so only HTTP traffic coming from the main site and site A going only to the internet goes through the CX module. How can I set this up to accomplish this?
    I have attached a topology diagram.

    That is what I needed help with but here is what I was thinking.
    ! Create needed groups
    object-group network CX-BYPASS-SITE2SITE
    net 192.168.170.0 255.255.255.0
    ! from CX-BYPASS-SITE2SITE to ANY via HTTP - bypass
    access-list CX_BYPASS deny tcp object-group CX-BYPASS-SITE2SITE any eq 80
    ! from any to CX-BYPASS-SITE2SITE via HTTP - bypass
    access-list CX_BYPASS deny tcp any object-group CX-BYPASS-SITE2SITE eq 80
    ! CX inspects everything else
    access-list CX_BYPASS permit ip any any
    ! Config traffic through the CX
    class-map CX_REDIRECT
    no match any
    match access-list CX_BYPASS
    policy-map global_policy
    class CX_REDIRECT
    cxsc fail-open
    But I really only want to send HTTP traffic through the CX from the Main site and Site A to the internet, but this...
    ! CX inspects everything else
    access-list CX_BYPASS permit ip any any
    would send everything. How can I change that to just send HTTP traffic?
    ! CX inspects just HTTP traffic
    access-list CX_BYPASS permit tcp any any eq 80
    Would that would?
    Mike

  • Problems send string through Socket

    I'm writing a simple chat.
    The server-side, when receive a request from a client act in this way:
    1_ Choose a random port between 8000 and 8100
    2_ Verify if the port is alredy used (otherwise it randomize another port)
    3_ Create a dynamicServer instance that listen at the new randomized port
    4_ Communicate the port to the Client
    The program doesn't have any problem with the point 1, 2 and 3.
    But for some reason I can't explain, it doesn't communicate with the client.
    Can you explain me why? (I can't work it out by myself T_T)
    This is the code of the server-side:
    public class ProcessoServer extends Thread {
        private int cport, i = 0;
        public ServerSocket server;
        private Component SezionePrincipale;
        private PrintStream cPort;
        private int[] portUsed = new int[100];
        private ChPort choose;
        @Override
        public void run()
            try {
            while(true) {
                    server = new ServerSocket(7777);
                    Socket s1 = server.accept();
                    if(s1.getInetAddress().toString().equals("/127.0.0.1"))
                        server.close();
                        s1.close();
                        break;
                    else {
                        cport = 8000 + (int)(Math.random() * 100);
                        choose = new Chport(cport, portUsed);
                        while(choose.Check() == false)
                            cport = 8000 + (int)(Math.random() * 100);
                            choose = new Chport(cport, portUsed);
                        portUsed[i] = cport;
                        i++;
                        new DynamicServer(cport);
                        cPort = new PrintStream(s1.getOutputStream());
                        cPort.println(cport);
                        cPort.flush();
                        cPort.close();
                        s1.close();
            catch(IOException ex)
            //an error
        public void removePort(int port)
            for(int b = 0; b <= portUsed.length; b++) {
                if(port == portUsed) {
    portUsed[b] = -1;
    public void haltServer() throws UnknownHostException, IOException {
    Socket stop = new Socket("127.0.0.1", 7777);
    This is the code of the client-side.public Connection(InetAddress ip) throws IOException
    Socket s1 = new Socket(ip, 7777);
    BufferedReader port = new BufferedReader(new InputStreamReader(s1.getInputStream()));
    Integer newPort=Integer.parseInt(port.readLine());
    System.out.println("the new port is "+String.valueOf(portaNuova));
    s2 = new Socket(ip, newPort);
    port.close();
    s1.close();

    M3kka wrote:
    I'm doing this because I thought that every single conversation (I'm not exactly writing a chat, the program should be something more similar to an Instant Messager) needs a single SocketIt does not require new Server Sockets. Each Socket is unique while sharing the same server port.
    Am I wrong? Yep.
    As I indicated, this is a pretty common misconception. The uniqueness of each socket is made using several pieces of information, the host and port on one end and the host and port on the other end. One of these pieces of information must be unique. How this is handled is that the client is generally speaking assigned a random port by the client TCP implementation (aka the OS).
    At any rate you don't have to go through these gyrations, the sockets returned from ServerSocket.accept will all be unique. TCP already does that for you.
    If you haven't seen it yet be sure to check out [_The Java Networking Tutorial_|http://java.sun.com/docs/books/tutorial/networking/index.html]

  • Problems sending files throught TCP sockets

    I would like to transfer a file throught a tcp socket, here there is what the sender program does :
    try{
         File localFile = new File("shared/"+fileName);
         DataOutputStream oos = new DataOutputStream(socket.getOutputStream());     
         DataInputStream fis = new DataInputStream(new FileInputStream(localFile));
         while(fis.available() > 0){
              oos.writeByte(fis.readByte());
         catch(Exception e){}here what the receiver program does:
         try{
         File downloadFile = new File("incoming/"+fileName);
         downloadFile.createNewFile();
         ois = new DataInputStream(connectionSocket.getInputStream());
         fos = new DataOutputStream(new FileOutputStream(downloadFile));
         while(ois.available() > 0){
              fos.writeByte(ois.readByte());
         catch(Exception e){}
    }Where i m wrong? it doesnt work :( , it just create the new file in the incoming folder, but its size remains 0 byte :(
    help a newbye please :D

    Your problem is probably related to the use of available. This is the amount that is currently in the buffer that you can read without blocking. For network programming you should expect to have to wait for data. Second, you are copying the data one byte at a time which is not very efficient. Try something like:
    // Sender
    try {
        File localFile = new File("shared/"+fileName);
        OutputStream out = socket.getOutputStream();     
        InputStream fis = new FileInputStream(localFile);
        int length;
        byte[] buffer = new byte[4096];
        while((length = fis.read(buffer)) != -1)
         out.write(buffer, 0, length);
        fis.close();
        out.close();
    catch(Exception e){}
    // Receiver
    try {
        File downloadFile = new File("incoming/"+fileName);
        IntputStream ois = connectedSocket.getIntputStream();     
        OutputStream fos = new FileOutputStream(downloadFile);
        int length;
        byte[] buffer = new byte[4096];
        while((length = ois.read(buffer)) != -1)
         fos.write(buffer, 0, length);
        fos.close();
        ois.close();
    catch(Exception e){}

  • Problem sending email through Comcast with Mac Mail

    I have seen this problem discussed here but no solution that I follow. Is there an
    easy fix to this. I am able to receive emails but...
    Here's the error message I get when I try to send from Mail:
    This message could not be delivered and will remain in your Outbox until it can be delivered.
    The sender address [email protected] was rejected by the server.
    I have tried changing the email address and the user name..but without success.
    The "Connection Doctor" in the Windows Menu went through a check and determined that my settings (POP Account and Internet connection status) were correct, as far as incoming and outgoing servers. ("connection to server succeeded") Didn't mention any other problems.
    Any help appreciated, thanks

    I managed to get things working by deleting my mail account then recreating. Although this has been suggested before, I encountered a comcast glitch during the process that may explain some of this misbehavior. Comcast asked us to create new 8 character passwords. However, the incoming mail server still wants you to log in to your old password, while the smtp server wants the new password.
    Although this may be more work than necessary, here is how I got my mail working again.
    Create temporary folder in Filed Mail and move messages in your inbox to the temporary folder.
    Delete your comcast acount.
    Recreate comcast account, using automatic setup.
    enter old password at first prompt.
    enter new password at second prompt when it looks for the correct PW to enable outgoing mail.

  • Problem sending mail through Irnport C160

    Hi all,
    we have some problem with using Ironport to sending email.
    The configuration seems to be correct infact some mail go out correctly. But for certain domain, the mail doesn't go out and if I check the message tracking I see this:
    01 Dec 2010 09:50:36 (GMT +01:00)
    (DCID 37095) Delivery started for message 46378 to [email protected], [email protected]
    01 Dec 2010 09:52:49 (GMT +01:00)
    (DCID 37095) Message 46378 to [email protected] delayed. Reason: 4.4.0 - Other network problem ('000', ['[Errno 60] Operation timed out']) []
    01 Dec 2010 09:52:49 (GMT +01:00)
    (DCID 37095) Message 46378 to [email protected] delayed. Reason: 4.4.0 - Other network problem ('000', ['[Errno 60] Operation timed out']) []
    01 Dec 2010 09:52:49 (GMT +01:00)
    Message 46378 to [email protected], [email protected] pending until Wed Dec 1 10:52:49 2010 as per bounce profile Default.
    I don't understand why I receive this error. If I send the email directly through my exchange, the email go out correctly.
    Any ideas?
    Regards
    Danilo

    Hi,
    Yes, we did but if we send using our private account its ok.
    (DCID 6365) Delivery started for message 2318 to [email protected], [email protected] 26 Nov 2010 09:10:48 (GMT +08:00) (DCID 6365) Message 2318 bounce verification rewriting sender [email protected] to prvs=939b8b86e=[email protected] 26 Nov 2010 09:14:48 (GMT +08:00) (DCID 6365) Message 2318 to [email protected] delayed. Reason: 4.4.0 - Other network problem ('000', ['[Errno 60] Operation timed out']) [] 26 Nov 2010 09:14:48 (GMT +08:00) (DCID 6365) Message 2318 to [email protected] delayed. Reason: 4.4.0 - Other network problem ('000', ['[Errno 60] Operation timed out']) [] 26 Nov 2010 09:14:48 (GMT +08:00) Message 2318 to [email protected], [email protected] pending until Fri Nov 26 10:14:48 2010 as per bounce profile Default
    Best regards,
    Alex Ling

  • Problem sending email through isp

    props.put("mail.smtp.host", "mail.google.com");
    props.put("mail.user", "[email protected]");
    props.put("mail.password", "mypass");
    Session s = Session.getInstance(props,null);
    InternetAddress from = new InternetAddress("[email protected]");
    InternetAddress to = new InternetAddress("[email protected]");
    MimeMessage message = new MimeMessage(s);
    message.setFrom(from);
    message.addRecipient(Message.RecipientType.TO, to);
    message.setSubject("Your subject");
    message.setText("Your text");
    Transport.send(message);
    This would normally work on my home isp which is talk talk but when i am away from home connection and use the mobile connection of vodaphone my mail program comes up saying
    javax.mail.NoSuchProviderException: smtp
    at javax.mail.Session.getService(Session.java:780)
    at javax.mail.Session.getTransport(Session.java:718)
    at javax.mail.Session.getTransport(Session.java:661)
    at javax.mail.Session.getTransport(Session.java:641)
    at javax.mail.Session.getTransport(Session.java:696)
    at javax.mail.Transport.send0(Transport.java:186)
    at javax.mail.Transport.send(Transport.java:118)
    at test.mail.Emailer2.<init>(Emailer2.java:45)
    at test.mail.Emailer2.main(Emailer2.java:52)
    any idea as why this happens and how to get round it. Is there any know issues?
    Thanks in advance

    That makes no sense.
    You're using the same application on the same computer, and if
    connected to your home ISP it works, but if connected to Vodaphone
    it fails with NoSuchProviderException? I don't believe it.
    That exception only depends on whether JavaMail can find the
    provider in its configuration file. It has nothing to do with whether
    you're connected to any network or not.

  • Having problems SENDING mail through hostway account (relay error msg)?

    Want to spare others the 2 week nightmare of configuring email so that "relay error" message would not prevent emails from being sent.
    Settings / Accounts/ mail/ then...
    1. enter pop/smtp account and pw
    2 SMPT settings: "authentication" - check "password"
                               SSL - "OFF' if port setting is 587
                                         "ON" if port setting is 465
    3. Enter both user name and password where it says "optional"
    Good luck!

    Try this, it will create a mailbox in messaging and work like your desktop, to refresh you need to hi-lite the mailbox then select options-sync email, use it on my N97 instaed of standard email
    http://forum.dailymobile.se/index.php?action=dlattach;topic=426.0;attach=43906
    Just download to pc drag and drop to phone and install !
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

  • Problem in sending mail through dynamics actions

    Hi Friends,
    I have a problem in sending mail through dynamics actions . In this  we pass a subroutine in dynamics actions which send an mail when promotion action occured.
    Problem is that sometimes it will  send an mail or sometimes not. I have no idea to solve this problem.
    Can anyone suggest me .
    Thanks ,
    Anish
    Moderator message : Duplicate post locked.
    Edited by: Vinod Kumar on Sep 5, 2011 9:45 AM

    Hi,
    Check that all the bindings have been done in proper way as it is configured.. Try to do the binding manualy..This could also be the problem..
    thank You

  • Problem in sending mail through workflow

    Hi All,
      I am trying to create a workflow. I created a workflow and once document is made, this workflow trigerrs and i am able to get user decision to my user id. once if i click on approve, mail should be triggered to my mail id. but mail is not coming to my mail id. i checked in SOST transaction, <b>mail status set to Transmitted.</b>, and not as sent .
    But i tested a sample test message from sbwp to my mail id and it is working fine. Only through workflow, sending message to outlook is not working. i checked my user in the system in SU01 transaction also, there also mail id is mentioned. what could be reason for not able to send mails through workflow.?
    Its urgent.
    Points will be awarded to all.
    Regards,
    vinoth

    Hi,
    Check that all the bindings have been done in proper way as it is configured.. Try to do the binding manualy..This could also be the problem..
    thank You

  • TS3276 I receive a pop up from ICal saying the server does not recognize me user name and password.  This started yesterday.  I have no problems with receiving or sending emails through Mail

    I receive a pop-up from ICal saying the server does not recognize my user name and password for my me.com email address.  This started yesterday and occurs about every 5 minutes or so.  There are no problems with receiving or sending email through Mail.  I did change me email password several days ago but have no problems sending/receiving since then.

    I fixed the problem.  I opened Preferences in ICal and entered my new password.  No more pop-ups

Maybe you are looking for