How to transfer large datagram packet via MulticastSocket

Hi all, i'm trying to do a program with capable to capture screen and send out through MulticastSocket. I'm able to do everything and send out which the packet must be below 65535 Byte. Any packet more than 65535 Byte would not able to send out.
An original captured image file size is approximately about 300K Byte.
I also tried to reduce the image quality, but it doesn't look nice, because the image can't even present properly after the quality adjustment.
I'm wondering is there any other method to send out the packet without any compression or any good compression but good image quality remain??
But i'm looking for more better packet transmission for packet size more than 65535 Byte...
These are the code:
InetAddress multicastAddress = InetAddress.getByName("224.5.6.7");
socket = new MulticastSocket(6789);
Robot robot = new Robot();
//Capture Image
BufferedImage bufferedImage = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
Iterator<ImageWriter> writers = ImageIO.getImageWritersBySuffix("jpeg");
if (!writers.hasNext()) throw new IllegalStateException("No writers found");
ImageWriter writer = (ImageWriter) writers.next();
//Set Image Quality
ImageWriteParam param = writer.getDefaultWriteParam();
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
//param.setCompressionQuality(1);
param.setCompressionQuality(0.2f); //So far 0.2f is the highest compression and highest quality to transfer, approximately 30K~50K size of packet
//Write/Change Image Quality
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImageOutputStream ios = ImageIO.createImageOutputStream(bos);
writer.setOutput(ios);
writer.write(null, new IIOImage(bufferedImage, null, null), param);
ios.flush();
//Send packet
DatagramPacket sendPacket = new DatagramPacket(bos.toByteArray(), bos.toByteArray().length ,multicastAddress,6789);
socket.send(sendPacket); //Packet size cannot larger than 65535 ByteThanks in advance :)
Edited by: nick_khor on Jun 25, 2010 6:01 AM

Why, this is my final year project. Why should I lie?Err, you've just given a reason.
I admit this is and extra work, like you said, pointless. Because i really don't know other way to achieve this.That's strange. I've just given you another way to achieve this.
AND For sure the UTF-16 standard will corrupt the image after the conversion.So it's working?
But i don't think there is only "UTF-16". Because I use "ISO-8859-1"So that means it will work? Why?
This is where i got it.
http://stackoverflow.com/questions/520907/split-java-string-in-chunks-of-1024-bytes
(a) No, that's only where you got how to split a String, and you don't need stackoverflow.com for that, just String.substring(). But you don't need Strings at all, see above. I also note that the answer there with the highest number of votes says 'Strings and bytes are two completely different things, so wanting to split a String into bytes is as meaningless as wanting to split a painting into verses.' So it's not much of a source really.
(b) Have you cited that source in your project documentation?
If possible, could guide me on how to
"traverse the original byte array, changing the offset, creating DatagramPackets, and sending them, and accumulating at the receiver."It seems perfectly clear to me. Clear enough for a final year student to turn into code.
I really don't know how it work.
I really don't know how turning things into and out of Strings pointlessly can work either. if I was marking this assignment you would fail.

Similar Messages

  • How to transfer large files(1GB) to pc

    How to transfer large files(1GB) to pc

    Or possibly alternatively, and if really desperate, upload it to file distribution service like Fileserve or Rapidshare and then download it from the other machine (and then delete the upload).  Many of these services have a free mode although they may have size limitations and they certainly throttle the download speed down (Rapidshare may be one of the worse, Fileserve one of the best).  Personally I never tried something the size of 3GB.  What I do see is that stuff that large is generally broken up into multiple files to get around the size limitations and to be glued together when all the parts are downloaded.
    Just throwing this "out there" as an alternative but as I said, you probably would need to really be desparate to go this route

  • How to transfer large files from macbook pro to External Hard Drive?

    I want to transfer a file from my Mac to an external hard drive, it says "The item “File name” can’t be copied because it is too large for the volume's format."
    I am trapped, if there is any way you could suggest me to overcome this problem I will be grateful.

    I may be wrong, but I believe the format has something to do with it - note the sizes here (from the Help in Disk Utility on how to format a drive for Windows):

  • How to transfer large transactional tables from RFC to background ABAP?

    Which is preferrable to use ABAP memory, SHARED MEMORY/BUFFER or SHARED ABAP OBJECTS in my scenario:  I have an external application sending two tables to an RFC.  The tables are made up of transaction data and can approach 1 GB in size.
    The RFC times out, since it is a dialogue process. Therefore, I programmed the RFC to SUBMIT a background job VIA JOB.
    QUESTION: How to import internal table into a program that was submitted via JOB?
    Do I have to use SHARED MEMORY/SHARED BUFFER, or can I still use ABAP memory?
    Can I send a table in a parameter in SUBMIT WITH construct?
    An issue I have encountered is that the result of the IMPORT FROM SHARED BUFFER constructu  is not consistent in consecutive executions. Why would the result of the  IMPORT be inconsistent if the code is exactly the same and the data is exactly the same?
    FYI I am building the memory ID dynamically and then sending in SUBMIT WITH parmeter?
    Please don't post links to SAP HELP documentation.. I have read it, re-read it and read it again.
    I really need expert experience, not generic documentation.
    Thanks in advance.

    Hi here is an example for the submit command use,
    You can call one selection screen from other selection screen program using SUBMIT command.
    The syntax is as follows -
    codeSUBMIT... VIA SELECTION-SCREEN
    USING SELECTION-SET <var>
    WITH <sel> <criterion>
    WITH FREE SELECTIONS <freesel>
    WITH SELECTION-TABLE <rspar>.[/code]
    e.g.
    The following executable program (report) creates a selection screen containing the parameter PARAMET and the selection criterion SELECTO:
    codeREPORT demo_program_submit_rep1.
    DATA number TYPE i.
    PARAMETERS paramet(14) TYPE c.
    SELECT-OPTIONS selecto FOR number.[/code]
    The program DEMO_PROGRAM_SUBMIT_REP1 is called by the following program using various parameters:
    codeREPORT demo_program_submit_sel_screen NO STANDARD PAGE HEADING.
    DATA: int TYPE i,
    rspar TYPE TABLE OF rsparams,
    wa_rspar LIKE LINE OF rspar.
    RANGES seltab FOR int.
    WRITE: 'Select a Selection!',
    SKIP.
    FORMAT HOTSPOT COLOR 5 INVERSE ON.
    WRITE: 'Selection 1',
    / 'Selection 2'.
    AT LINE-SELECTION.
    CASE sy-lilli.
    WHEN 4.
    seltab-sign = 'I'. seltab-option = 'BT'.
    seltab-low = 1. seltab-high = 5.
    APPEND seltab.
    SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
    WITH paramet eq 'Selection 1'
    WITH selecto IN seltab
    WITH selecto ne 3
    AND RETURN.
    WHEN 5.
    wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.
    wa_rspar-sign = 'E'. wa_rspar-option = 'BT'.
    wa_rspar-low = 14. wa_rspar-high = 17.
    APPEND wa_rspar TO rspar.
    wa_rspar-selname = 'PARAMET'. wa_rspar-kind = 'P'.
    wa_rspar-low = 'Selection 2'.
    APPEND wa_rspar TO rspar.
    wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.
    wa_rspar-sign = 'I'. wa_rspar-option = 'GT'.
    wa_rspar-low = 10.
    APPEND wa_rspar TO rspar.
    SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
    WITH SELECTION-TABLE rspar
    AND RETURN.
    ENDCASE.[/code]
    => To leave a called program, you can use SUBMIT .... AND RETURN. by choosing F3 or F15 from list level 0 of the called report.
    Hope this helps.
    regards,
    venkat

  • How to transfer data( not multimedia) via bluetooth?

    How can i transfer some data which are not multimedia data between two J2ME WTK emulators running on two different systems. If u can supply with the code it will be helpful indeed.Thanx

    Hi
    i have also started my work on this if you get any tips or suggestions please share it with me.
    Thanks

  • SOAP response in attachment - how to transfer this to ERP via XI adapter?

    Hi all
    We have a proxy <-> PI <-> WS scenario
    We use "Do not use SOAP envelope" in order to create a specific header info for the WS.
    The reply from the WS puts the response (xml) in the payload attachment.
    Everything is ok in PI
    But the generated proxy on the ERP side fails/throws exception because of missing payload (expected as main document and not as attachment).
    How can we get this corrected?
    I have tried to use the PayloadSwapBean module without luck (but perhaps I'm missing how to fill out the keyname and keyvalue - someone having an example showing how to use this module in this situation?)
    Perhaps there is a solution/option when generating the proxy?
    All help is very welcome
    Thanks
    Peter

    Thanks for the input.
    We receive the following RAW-format reply from the provider.
    Any ideas of the values KeyName and KeyValue in order to get the envelope treated as the main document and not an attachment?
    HTTP/1.1 ....
    Date: Tue, 01 Nov 2011 06:50:19 GMT
    Server: Microsoft-IIS/6.0
    X-Powered-By: ASP.NET
    RequestTime: 00:00:00.9687438
    Cache-Control: no-cache, no-store
    Pragma: no-cache
    Expires: -1
    Content-Type: text/xml; charset=utf-8
    Content-Length: 1182
    <?xml version="1.0" encoding="utf-8"?><env:Envelope
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header>....</env:Body></env:Envelope>
    Thanks
    Peter

  • Transfer large voice memos after deleting them from iTunes

    I cannot for the life of me figure out how to transfer large voice memos to my computer from my iPhone.
    I synced my phone without changing the names of the voice memos--- so they were in iTunes in a random order and it just confused me. I deleted them in iTunes and renamed them in my voice memos..... now I can't download them with the correct name! I can't find how to get them back off the iPhone into my iTunes or even to my desktop to burn onto a CD. ???????
    I cannot email them or message them because they are large files. I've tried to email them and it states that an email has been sent (there was an email sent sound) but nothing ever shows up in my email account.
    All I want to do is put my newly titled voice memos into a folder on my desktop.
    PLEASE help! I wish this was easier to do!

    i feel your pain
    this is so infuriating
    it's great little app, and so easy to record audio on the fly.
    BUT then absolutely impossible to easily transfer them to my desktop.
    infuriating

  • How do I make a Datagram Packet from a String?

    I am looking to make a Datagram Packet from a string. If I send a command to a server that allows remote connections via UDP, such as "restart" it will restart the server. I can accomplish this easily through the fput() method of PHP.
    I want a Java version of my utility, and am using the DatagramSocket and DatagramPacket classes. I see that I need to make a byte array and put it inside a DatagramPacket. How would I go about putting the string "restart" into a byte array?
    Thanks,

    Use the following code to send a Datagram:-
    import java.io.*;
    import java.net.*;
    // This class sends the specified text as a datagram to port 6010 of the
    // specified host.
    public class UDPSend {
        static final int port = 6010;
        public static void main(String args[]) throws Exception {
            if (args.length != 2) {
                System.out.println("Usage: java UDPSend <hostname> <message>");
                System.exit(0);
            // Get the internet address of the specified host
            InetAddress address = InetAddress.getByName(args[0]);
            // Convert the message to an array of bytes
            int msglen = args[1].length();
            byte[] message = new byte[msglen];
            args[1].getBytes(0, msglen, message, 0);
            // Initilize the packet with data and address
            DatagramPacket packet = new DatagramPacket(message, msglen,
                                   address, port);
            // Create a socket, and send the packet through it.
            DatagramSocket socket = new DatagramSocket();
            socket.send(packet);
    }This uses argments, if you want a string change the code accordingly.

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • How to upload large file with http via post

    Hi guys,
    Does anybody know how to upload large file (>100 MB) use applet to servlet with http via post method? Thanks in advance.
    Regards,
    Mark.

    Hi SuckRatE
    Thanks for your reply. Could you give me some client side code to upload a large file. I use URL to connect to server. It throws out of memory exception. The part of client code is below:
    // connect to the servlet
    URL theServlet = new URL(servletLocation);
    URLConnection servletConnection = theServlet.openConnection();
    // inform the connection that we will send output and accept input
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    // Don't used a cached version of URL connection.
    servletConnection.setUseCaches (false);
    servletConnection.setDefaultUseCaches(false);
    // Specify the content type that we will send text data
    servletConnection.setRequestProperty("Content-Type",
    +"application/octet-stream");
    // send the user string to the servlet.
    OutputStream outStream = servletConnection.getOutputStream();
    FileInputStream filein = new FileInputStream(largeFile);
    //BufferedReader in = new BufferedReader(new InputStreamReader
    +(servletConnection.getInputStream()));
    //System.out.println("tempCurrent = "+in.readLine());
    byte abyte[] = new byte[2048];
    int cnt = 0;
    while((cnt = filein.read(abyte)) > 0)
    outStream.write(abyte, 0, cnt);
    filein.close();
    outStream.flush();
    outStream.close();
    Regards,
    Mark.

  • How to transfer data from ECC to CRM via IDocs (Clfmas01),

    Hi all,
    how to transfer data from ECC to CRM via IDocs (Clfmas01), that to material master data from ECC to Production master data in CRM.    
    Need Information regarding, how to upload file to CRM from ECC, through, IDocs......Plz help me...
    Edited by: khaja fareed on Jan 11, 2010 12:44 PM

    First of all push ECC data in to GTS server through T.code:/N/SAPSLL/MENU_LEGALR3. First click on Master data tab there enter customer/vendor number then execute.
    2-Go to document tab there enter Sales order no/PO number then execute it.
    Then go to GTS server in compliance management module you can get all the information.
    Regards
    Sitanshu Panigrahi

  • How do I transfer larger PDF files stored in iBooks to replacement iPad?

    How do I transfer larger PDF files stored in iBooks to replacement iPad?

    Do you sync with iTunes and are the PDF files in your iTunes library? If they are, sync the iPad with iTunes.

  • How to transfer an app to another iPad via a PC?

      Hi, iPad gurus!
      I've been asked for help by an acquaintance of mine. iPads are unfamiliar to me. I'm not even friends with sync of iPhone apps installed on my MacBook Pro.
      Actually, I've got two questions.
      Question 1:
      Is it possible to download iPad apps with the help of a non-Apple computer (Sony Vaio)?
      I mean, to be able to enter the store for iPad applications, then to send the app to an iPad somehow.
      The reason why I want to use a non Mac gadget is that I think that it's more convenient to work with apps or with any data at anything larger than iPads, while at home. Moreover, imho, the device should be the largest available in the house. The acquaintance has a MacBook Air. But he's also got an access to a large Sony monitor with a full size large keyboard.
      Question 2.
      Now, there are two iPads  (I'll give them the names: iPad #1 and iPad #2). The task is to install on one iPad (iPad #2) all the same apps that have already been installed on another iPad. I mean to synchronize, cutting the full path which has been passed by iPad #1  (that is, without the process of looking up for each separate app somewhere in the Internet or iTunes). When I was asked for help, I was unable to offer anything except to manually install on iPad #2 the same app, that had been on iPad #1. And you know, what I can't explain was that while I was busy installing Viber, another freshly installed app from iPad #1 appeared on iPad #2 without my efforts (Russian Yandex Navigator).  
      So, how do I arrange the sync?

    Do both iPads use the same Apple ID?
    How to Transfer Everything from an Old iPad to New iPad
    http://osxdaily.com/2012/03/16/transfer-old-ipad-to-new-ipad/
     Cheers, Tom

  • NIO- how to best transfer large binary files 200mb

    Hi there,
    For my dissertation I am in the process of implementing a LAN- NIO based distributed system most of it is working except I cant figure out how to best transfer large files >200mb.
    1. Client registers as available
    2. Server notifies that a job is available on file x
    3. Client requests file x
    4. Server transfers file x- without reading the whole file into memory-
    5- Client does its thing and tells the server the results are ready-
    6. Server requests results.
    This is all implemented, except for the actual file transfers, which just wont work the way I want it. I got access to a shared drive that I could copy to and from, but Java still reads all bytes fully into memory. I did a naughty workaround of calling windows native copy command ( runtime() ) which does the trick, though I would prefer that my app did the file handling since I need to know when things are done.
    Can anyone provide me with a link to an example / tutorial of how to do this, or is there a better way of transferring large files like tunneling, streaming, ftp or the old way of splitting into chunks with headers (1024 bits, byteFlip() etc) how is this usually done out there in the proper world?
    I did search the forum, and found hints and tips though I thought perhaps I would see if there is a best practice for this problem--
    Thanks,
    Thorsan

    Hi,
    I have tried various approaches with out much luck, think part of the problem is I have never done file transfers in java over networks before...
    At the moment I let the user select files from a JFileChooser, and store the String path+filename in a list. When a file is to be transferred I do the following:
    static void copyNIO(File f, String newFile) throws Exception {
            File f2 = new File(newFile);     
            FileChannel src = new FileInputStream(f).getChannel();
            FileChannel dst = new FileOutputStream(f2).getChannel();
            dst.transferFrom(src, 0, src.size());
            src.close();
            dst.close();
        }This lets me copy the file to wherever I want to without going through a socket, since I am developing in a lan environment this was ok for debugging. Though sooner or later it has to go through the network.
    I have allso played around with ObjectOutputStream and ObjectInputStream but again I just cant figure out how to inhibit my source from loading the whole file into memory. I want to read / write in blocks to keep the memory usage to a minimal.
    Thorsan

  • How to transfer garageband files from mac to ipad2 via internet?

    how to transfer garageband files from mac to ipad2 via internet?

    I'm asking this question 'cause we do music over internet and I need to send these files to my mate via internet to his ipad2..Didnt know that it doesnt work..Is there any other solution for that?..Thanx for answer anyway..

Maybe you are looking for

  • Time Machine BUG: Without warning, one or more of your disks stops being backed up...

    Hi all Just discovered an interesting and potentially dangerous bug in TM running 10.7.4 (like many others I've downgraded from 10.7.5 because of the Spotlight/TM problems noted in this forum). Here's the bug: You set up TM and specify certain items

  • I can't get the old account out my update

    I can not get the old account off even if I sign in on my new account the old still show up and I can't update how do I get the old one out my iPad I tried signing out and in, my new account is in but when I try to update something an old account pop

  • Save a JSF page as word document

    Hi All, I have a simple JSF page with some generated content. In that page, there is a button as "save as word". When the link is clicked , i need the save dialog to appear and prompt the user to save the content in the JSP page as word document.How

  • Can Oracle 10g and Oracle 9i coexist and run together in one machine

    Dear Friends, I have installed Oracle 10g on my machine which already had Oracle 9i - 9.1.2.0 Release. Now the problem is that when i try to create a service name it gives me this error- ORA-12514: TNS:listener does not currently know of service requ

  • Frustration with Address Book

    Has anyone found a work-around for copy/paste of an entire contact card in Address Book? Address Book used to allow you highlight and copy all of the content of a contact v-card. Since Snow Leopard released (including the 10.6.2 update), it only allo