Click here to Skip to main content
15,902,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
somebody can help me? i try to build sms compressor for my thesis. the program is running and i can compress the message i input, but something strange happen, the message i compress, the program counts 66 char for 1 page...

i have built the simple program just for sending and receiving text message, but it run regularly like ordinary sms application at handphone, 1 message contains 160chars.

somebody can tell me, why the compression makes the char decrease into 66 char?

public void run()
{
    System.out.println("SMS yg akan dikirim: " + isiSms + " (" +
            isiSms.toString().length() + ")");
    String outSimpan = new String(isiSms);
    simpanSmsout(NoTujAkhir, outSimpan);

    //sets address to send message
    String address = "sms://" + NoTujAkhir + ":" + smsPort;

    MessageConnection smsconnKir = null;
    Message smsnya = null;
    try
    {
        // opens connection
        smsconnKir = (MessageConnection) Connector.open(address);

        // prepare text message
        TextMessage txtmessage =
                (TextMessage) smsconnKir.newMessage(MessageConnection.TEXT_MESSAGE);
        txtmessage.setAddress(address);
        // set text
        txtmessage.setPayloadText(isiSms);
        smsnya = txtmessage;
        // send message
        smsconnKir.send(smsnya);
    }
    catch (Throwable t)
    {
        t.printStackTrace();
    }

    if (smsconnKir != null)
    {
        try
        {
            smsconnKir.close();
        }
        catch (IOException ioe)
        { }
    }
}


that's the code for send sms, i think nothing different with the regularly.
Posted
Updated 10-Feb-10 1:34am
v2

1 solution

Os the value of isiSms 160 chars at the start or has it already been reduced? There really is nothing in the code you've provided, but I'll give some general tips:

Make sure your message handling and compression / decompression are seperated.
The outbound flow should be compress the text, check that is okay, send the compressed text.
The inbound flow should be receive the compressed text, decompress the text, check that is okay.

Test that you can take a message, compress it, decompress it and get the original back.


If/when you need more information, edit your question with more details and I [or someone] will come back.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900