Sending & Receiving compressed Data

Hi, How can i send & receive compressed data over a network using DeflaterInputStream and InflaterOutputStream, thanks.

You probably would not use those classes directly, but GZIPInput and GZIPOutput stream instead. you would wrap those streams around the socket Input and Output streams at either end of a socket connection.

Similar Messages

  • Can I use J2ME to send/receive GPRS data?

    Hi guys
    Firstly, I hope I'm on the most suitable forum - if not, feel free to redirect me to the best place for this question.
    I'm working on a vehicle tracking project and we're evaluating several devices that are designed to be placed inside vehicles - the devices have GPS capability for vehicle tracking and SMS or GPRS functionality to send or receive data.
    What we'd like to be able to do is to have these tracking boxes relay vehicle positioning information back to a central server PC over GPRS. Also, we'd like the server to be able to send information back to the devices. The tracking boxes do not support Java, so I'm concentrating completely on the server side of things... so here's my question....
    Can I send and receive data to and from these devices over GPRS using something like a GPRS WLAN card? If I can, what's the best way to do this?
    I don't really know too much about J2ME so feel free to "dumb things down" if you need to.
    Thanks a million,
    Jason

    off the top of my head:
    How about sourcing for a SCADA / telemetry package that support GPRS I/O? So you have the scada run time on your server, and you can ask for a GPRS to ethernet card along with it.
    It'd probly not be cheap but if it's a university project you could get a trial / edu version.
    Try wonderware (www.wonderware.com) as they're pretty aggressive in sales.
    I believe J2me is java technology for mobile devices, so J2me is for developing applications that have small memory footprint so that they can be deployed on mobile devices like hand phone and pdas. So, yes, I think you're in the wrong forum!

  • Sending /receiving object data from JavaNIO bytebuffer

    Hello All,
    i have designed a real time Physics simulation with javanio , which is about moving balls simultaneously (real time) on multiple clients.
    Currently, i m sending the coordinates of one ball with string parsing, but now i want to move multiple balls and want to have some generic mechanism other than sending string, so i create 4 balls on server.
    my design with string base is already running (one ball which is running from server, receiving coordinates as string on clients now i want more balls so i have problem to send the coordinate for each ball and receiving the same on client to draw while there are no reference attach to those which ball correspond to which ball on client) but i need little bit generic solution which can be valid for other simulations too.
    This should be realized by sending the reference of each ball but i don't have idea how to realized that with java byte buffer and with javanio overall.
    how i can realized, so that coordinates of each ball correspond to same ball on client (which i created on client too), and each ball can be move according to its received coordinates from the sever.
    I have the problem with implementation, if somebody help me with code example , it would be great, anyway which can be generic for sending simulation data like object coordinates other than strings can be acceptable(if somebody did similar work) but it should implement the usecase as i described.
    Thanks,
    Jibbylala
    PS: i saw this post:http://www.coderanch.com/t/276259/Streams/java/Convert-ByteBuffer-object
    they are sending the whole object but i just wanted to send
    Ball.X ,Ball[i].Y and receive the same at client sit
    Edited by: 805185 on Mar 20, 2011 8:29 PM

    I think the question here is that if you have n balls on the server, and you receive coordinates on the client, how the client will know for which ball the coordinates are meant. The answer is pretty simple: just modify your protocol to send the ball number before you send the coordinates. You say you currently use strings to represent the coordinates. Say your string currently looks like this: x|y, where x is the x-coordinate, | the separator and y the y coordinate. You could modify this string as follows: n|x|y, where n is the ball number, x the x coordinate and y the y coordinate. This way the client knows for which ball the coordinates are meant.
    If you want to avoid the string parsing, use the ByteBuffer.putDouble() and ByteBuffer.putInt() methods as suggested by EJP.

  • Why is my iPad constantly sending/receiving (?) data via wifi?

    I notice that even when I am not using my iPad that my modem is indicating that data is being transferred (no other devices connected) and when I turn off the wifi mode on the iPad the lights on the modem no longer flash. I have attempted to turn off anything that I think might be running in the background...???

    Thank you, that seems to help some. I have turned off the main switch in "background app refresh" but I still see activity on my modem (?).

  • Help with receiving compressed network data

    I'm trying to send some compressed data over a network connection from a server (written in C) to my Java program. My server sends the length of the compressed data (in bytes) as a regular integer, then sends the compressed data itself. Therefore, my client is essentially this:
    open Socket
    while (true) {
    read an int from the socket, using a DataInputStream object
    allocate new byte array using the size provided above
    read bytes from socket, using the DataInputStream object
    decompress bytes, using an Inflater object
    parse decompressed data
    But prior to reading any compressed data, I have to do this:
    while (dataIn.available() < amount_of_compressed_data) { ; }
    where dataIn is my DataInputStream object, or else I get tons of zlib errors (header errors, data errors, internal stream errors) when I try to decompress my data. I thought that Sockets in Java were blocking though, and I shouldn't have had to do this. Can anyone explain?
    Also, when I use an SSLSocket instead of a regular Socket, dataIn.available() always returns zero so my client is stuck in an infinite loop. I know the SSL handshake stuff has been set up properly because the client can send messages to the server which are handled correctly, so the problem isn't that. I know the bytes are being sent over the network from the server to the client because I can see them using Ethereal, but for some reason they never show up when calling available(). If I remove that call, I can read bytes from the SSLSocket but I get the zlib errors mentioned above. Does anyone know why this would be?
    thanks in advance for any help.
    - Dan

    hi, thanks for your response.
    Have you verified the order of the bytes in the int?
    Are you sure that you are getting the correct length?
    Different platforms can use different order for the
    bytes in an in (little vs big endian). Are you
    writing in network order?yes. The server calls htonl() before sending integers over the network, and I believe that using the DataInputStream class to read those integers will take care of byte order for me.
    Read the documentation for available:
    "Returns the number of bytes that can be read (or
    skipped over) from this input stream without blocking
    by the next caller of a method for this input stream.
    The next caller might be the same thread or or
    another thread.
    The available method for class InputStream always
    returns 0. "
    It says one important thing. Streams can return zero.
    They don't have to return a number which says how
    many bytes there are available.
    Kajoops. So if I remove the calls to available() because they don't do what I want, I get the data integrity exceptions I mentioned earlier. It seems to be a problem with my Inflater. It doesn't return the expected amount of uncompressed bytes (a value which the client will always know ahead of time), even though I'm passing it the correct amount of compressed bytes.
    Here's the relevant portion of my code:
    while (true) {
        try {
            DataInputStream dis = new DataInputStream(net_socket.getInputStream());
            /* get size of compressed data */
            int compressed_size = -1;
            byte[] compressed_data = null;
    //        while (dis.available() < 4) { ; }
            compressed_size = dis.readInt();
            System.out.println("reading " + compressed_size + " bytes of compressed data");
            compressed_data = new byte[compressed_size];
            /* get compressed data */
    //        while (dis.available() < compressed_size) { ; }
            dis.read(compressed_data, 0, compressed_size);
            /* zlib header integrity check - should output 0x78, 0x9c */
            System.out.println("0x" + Integer.toHexString(compressed_data[0]));
            System.out.println("0x" + Integer.toHexString(compressed_data[1]));
            /* uncompress data */
            Inflater i = new Inflater();
            byte[] uncompressed_data = new byte[PACKET_SIZE];
            int uncompressed_size = -1;
            i.reset();
            i.setInput(compressed_data);
            uncompressed_size = i.inflate(uncompressed_data);
            System.out.println("received " + uncompressed_size + " bytes of uncompressed data");
            /* consume data here */
        catch (Exception e) {
            e.printStackTrace();
    }thanks again for any help.
    - Dan

  • I need to find out how much wifi data my apps are using. I have a very limited amount of wifi data, and I am exceeding my monthly allowance. Apparently, even apps I think are not open are sending/receiving data through the wifi and using up my allowance.

    I need to find out how much wifi data my apps are using. I am on a very limited amount of WiFi data each month, which I am regularly exceeding. I have been told to work out which of my apps is using the data. Also, I think I have closed an app by double clicking the home button, then swiping the app up - is this the way to close it, or will it still be sending/receiving data?

    Go into your Settings : General : and turn off background refresh for your apps.  In Settings : Mail  turn Fetch new data to OFF and Load Remote Images to OFF.  This will mean that Mail will only check for messages when you actually use it, and all your advertising junk mail won't have all the images in it.
    Turn off push notifications every chance you get.
    Make sure you are actually quitting apps:  to quit apps press the Home button twice and you should see a bunch of smaller screen images for every open app.  To quit the app swipe from the screen image (not the icon) upward off the top of the iPad.  You can swipe left and right to see more open apps, but there must be no left-right movement on the screen when you swipe upward to close the app.
    Turn off your internet connection when you do not need it.  The easiest way to do this is to swipe up from the bottom of you screen to get the control centre, and then touch the airplane to turn on airplane mode.  You can repeat this sequence to turn it back on again when you need it.  Most especially turn airplane mode on whenever you are sleeping your iPad for long periods.  This will save battery life too.  OR actually turn your iPad off - which means holding the power key down for several seconds until the red swipe bar appears, and then swipe to turn it off.  If you go this route, note that it will take longer to turn on then it takes to wake from sleep.

  • Data types for Sender/receiver JDBC

    HI experts,
    I am very much confused how the data types shoudl be for the Sender/receiver for JDBC.
    And is there any standard format where it should be used, or what is the strucutre to be used,.
    Please let me know in clear and help me out in this regard,

    refer these blogs for better informations on jdbc data types
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/file%252bto%252bjdbc
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/jdbc%252b2%252bjdbc (for reciever JDBC)
    JDBC Receiver Adapter -- Synchronous Select – Step by Step

  • Data Types for JDBC Sender/Receiver Adapter

    HI experts,
                    I am very much confused how the data types shoudl be for the Sender/receiver for JDBC.
    And is there any standard format where it should be used, or what is the strucutre to be used,.
    Please let me know in clear and help me out in this regard,
    Edited by: Amruth on Dec 4, 2008 6:11 AM

    HI Nagarjuna,
    If my understanding is correct, When you trigger the Idoc from R/3 it thrown the error in XI.
    If  you want to send the same Idoc then go to WE19 in R/3 system enter the same Idoc number and execute the scenaio. It send the Idoc to XI system, but the message number will change.
    Regards
    Goli Sridhar

  • Send/receive data without a terminating character

    I am trying to use the visa driver to send hex data over a serial port. I have tried to disable terminating characters but when I read from the port the trasnmission still terminates with a 0x0A character. How can I send/receive data without a terminating character???

    You need to call viSetAttribute with VI_ATTR_ASRL_END_IN set to VI_ASRL_END_NONE. In LabVIEW, use a write property node with the Serial End In mode set to None (0).
    Dan Mondrik
    Senior Software Engineer, NI-VISA
    National Instruments

  • Question about send/receive data in as3

    hello
    i want to ask : how can i send data from flash to php using as3 and receive data from php using flash .
    and another question : how can i upload files using as3 .
    thank you .

    Look into URLLoader documentation for sending/receiving and FileReference for uploading:
    http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/URLLoader.html
    http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/net/FileReference.html

  • Socket data send-receive problem

    I hv J2ME client application and vb.net socket server application communicating over sockets. Client connection is made successfully but cant send data to server. When I exit from client application then server application receives those data. (application works pretty fine on emulator but on real device gives above problem)
    WTK Sample application gives same problem when I tried.
    Any idea abt this problem ? gr8 ful if u have some working code.

    yeah your idea works..
    I hv used flush() method and now it works (Live on Nokia E62) nicely.
    But to keep connection opened during whole application I dont close InputStream/OutputStream connection. I close it only at EXIT of application so that I get optimum performace in transactions.

  • Good night I have the question of a message that I have received in my mobile, if I won 715.000 pounds sterling on a lottery contest the Apple company, please let me answer if this is real lottery to send my personal data for the claim this prize.

    good night I have the question of a message that I have received in my mobile, if I won 715.000 pounds sterling on a lottery contest the Apple company, please let me answer if this is real lottery to send my personal data for the claim this prize.

    Scam. Do not divulge any personal or financial information.

  • SCOM SQL Query to find Mail Latency (Send/ Receive) Data.

    Hi,
    I unable to find Mail Latency (Send/ Receive) Data in SCOM 2012 SQL Query.
    need your help to find SQL query that fetches below details
    1. Average Time for Accessing Mailbox.
    2. Average Time to Send and Receive Mail.
    Regards,
    Vinoth Kumar.

    Hi Vinoth
    There are no specific tables storing the mailbox related data.
    To find information about Exchange in SCOM you need the Exchange management pack for the version of Exchange you are running, as well as monitoring the Exchange servers.
    When that has been done you can find reports and performance views for Exchange.
    I am unsure if you can find this specific information for Exchange in SCOM, i would look into the management pack. If you cannot find the information, i suggest you consult your Exchange administrator to get this information.
    www.coretech.dk - blog.coretech.dk

  • Why is my texting using data? When I have data turned off I can't send/receive. Texting is "unlimited" but it's using up all my data- help!

    Why is my texting using data? When I have data turned off I can't send/receive. Texting is "unlimited" but it's using up all my data- help!

    Texting longer text messages or any media (pictures/video/sound etc) being sent requires data to be active. However, it does not count against your data caps.
    Since you have an iPhone, you must also be aware of the difference between iMessage and SMS Text messages. The iPhone, by default, will send an iMessage when sending another text message to anyone else with an iPhone, iTouch, or iPad. This does use your data if you are not connected to wifi. In Settings, you can turn iMessage off, and then all of your texts will go through Verizon.
    Also understand- iMessage will use wifi when connected to wifi, but would need cellular data connection to work when not connected to wifi. Regular SMS text messages that are long or any media will always use the cellular data and not wifi, so will not send if cellular data is turned off, even if on wifi. However, this does not count against your cap.

  • Send and receive UDP data package based on siemens TC65 module

    Everyone:
    I am newer for J2ME. I have a TC65 module, I want to get a sending and receiving UDP data package exeample codes running on TC65. who can help me? thanks!

    Hi deepspace,
    I programmed a demo codes and run it on TC65T, debug trace like :
    at^sjra=a:/NetDemo.jar
    OK
    NetDemo: Constructor
    NetDemo: startApp
    NetDemo: Profile could not be activated
    NetDemo: destroyApp(true)
    // below is demo codes, can you help me where error is?
    package example.netdemo;
    import javax.microedition.midlet.*;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.io.Datagram;
    import javax.microedition.io.DatagramConnection;
    public class NetDemo extends MIDlet {
    public NetDemo()
    System.out.println("NetDemo: Constructor");
    public void startApp() throws MIDletStateChangeException
    System.out.println("NetDemo: startApp");
    try
    DatagramConnection conn = (DatagramConnection) Connector.open("datagram://58.185.157.91:12003");
    byte[] buffer = new byte[32];
    Datagram dgram = conn.newDatagram(buffer, buffer.length);
    for (int i = 0; i < 30; i++) {
    buffer[i] = (byte)('0' + (i % 10));
    conn.send(dgram);
    catch (Exception e)
    System.out.println("NetDemo: " + e.getMessage());
    destroyApp(true);
    public void pauseApp() {
    System.out.println("NetDemo: pauseApp()");
    public void destroyApp(boolean cond) {
    System.out.println("NetDemo: destroyApp(" + cond + ")");
    notifyDestroyed();
    }

Maybe you are looking for

  • Can't convert Word doc to pdf

    In the past, I have used both the adobe drop down menu in Word (Office 2007 version) and opened office documents in Adobe (Professional 8) to make pdfs, but now neither of those work.  If I go thru Word, it looks like its working, but then you see th

  • Change PS CC 2014 language

    installed ps cc 2014, downloaded at this site and in English. He wanted to spend the Portuguese to Brazil, in order to assess better. How do I?

  • Solaris 10 SoftwareGroups

    Is there a concise document etc.. that indicates what features are available in each solaris 10 software group? For example Core System Support Software Group - Contains the packages that provide the minimum code that is required to boot and run a ne

  • Solution for "ACR Thumbnails changes from as shot".

    Enclosed is a good explanation of the phenomena of the ACR thumbnail changing color, saturation, or whatever when you initially click on it.  I believe his reference to the 4 auto check boxes is in edit/camera raw preferences. http://www.luminous-lan

  • Airport base station Manage Profiles dimmed

    I cannot do this (Manage Profiles dimmed): "AirPort Extreme and AirPort Express Base Stations can store up to five configurations, known as profiles. A profile contains base station settings, such as names and passwords, and network configuration inf