Send encryption data through network

I'm doing encryption data exchanging project. I can describe my scenario anyone can give me good suggestion.
I use RSA Key pair. Client side encrypt the data using private key and server decrypt those data using particular public key. I store my keys in keystore. For one attempt I use public and private keys belong to one alias. My problem is when doing decryption in server side I got error message (BadPaddingException: Data must start with zero). But if I do encryption and decryption in same class using same keys without any client/server connection it works properly.
So, if anyone can give me any advice or suggestion, I'm very appreciat

ivanovpv wrote:
I think problem is somewhere in data transmission. During transmission either server or client adds extra padding information.No. For symmetric block based encrypted the clear text has to be padded to make it a full block. This is normally done as part of the encryption process using PKCS5 padding. Padding is also reqired for RSA encryption so as to make sure the cleartext ^ public_exponent is greater than the modulus. This is normally done using PKCS1 padding.
If the encrypted data is corrupt then one normally gets a exception such as BadPaddingException when decrypting using a symmetric algorithm or an exception indicating that the padded data should start with a zero in the case of RSA encryption.
It is almost certain that the OP has corrupted his encrypted data or his key, possibly by converting to a String without using Hex or Base64 encoding. Without seeing his code we will probably never know.
>
I would suggest just get your public key (i hope it's just a long/String probably wrapped within some class) then explicitly convert it into character array (best is to use UTF-8 encoding) - then transmit through network. On other side decode from UTF-8 character array into long/String - probably you'd need to instantiate public key object from your long/String and enjoy!String should never be used as a container for binary data and keys are binary data. Just converting them to a String specifying utf-8 will almost certainly corrupt them. If one must have a String version of any binary data whether it be a key or cipher text one should reversibly encode it using something like Base64 or Hex.

Similar Messages

  • How to send encrypted data through XI. Pls advice urgent

    Hi All,
    There is some customer confidental information that I need to
    send from source system to XI and then to target system.
    So client wants that data to be encrypted.Source and Target system can be File System or can be wsdl files.
    Please send me blogs/docs how this scenario can be made.
    Regards

    Hi,
    For this if you use SOAP Scenarios means you can have the Security settings in the SOAP Adapter itself
    Please search in SDn on SOAP Adapters
    Regards
    Seshagiri

  • Send encrypted data from oracle 11g to Ms SQL Server 12

    Hi every body,
    we want to send encrypted data from oracle 11g to Ms SQL Server 12:
    - data are encrypted to oracle
    - data should be sent encrypted to Ms SQL server
    - data will be decrypted in Ms SQL server by sensitive users.
    How can we do this senario, any one has contact simlare senario?
    can we use asymetric encription to do this senario?
    Please Help!!
    Thanks in advance.

    Hi,
      What you want to do about copying data from Oracle to SQL*Server using insert will work with the 12c gateway.  There was a problem trying to do this using the 11.2 gateway but it should be fixed with the 12c gateway.
    If 'insert' doesn't work then you can use the SQLPLUS 'copy' command, for example -
    SQL> COPY FROM SCOTT/TIGER@ORACLEDB -
    INSERT SCOTT.EMP@MSQL -
    USING SELECT * FROM EMP
    There is further information in this note available on My Oracle Support -
    Copying Data Between an Oracle Database and Non-Oracle Foreign Data Stores or Databases Using Gateways (Doc ID 171790.1)
    However, if the data is encrypted already in the Oracle database then it will be sent in the encrypted format. The gateway cannot decrypt the data before it is sent to SQL*Server.
    There is no specific documentation about the gateways and TDE.  TDE encrypts the data as it is in the Oracle database but I doubt that SQL*Server will be able to de-encrypt the Oracle data if it is passed in encrypted format and as far as I know it is not designed to be used for non-Oracle databases.
    The Gateway encrypts data as it is sent across the network for security but doesn't encrypt the data at source in the same way as TDE does.
    Regards,
    Mike

  • How to assign a button for attachment and send the data through browser ?

    Hi friends,
    How to convert to browser ?
    how to assign a button for attachment and send the data through browser ?
    Thanking you.
    Regards
    Subash.

    Refer to
    How to create a text box in ascreen painter?
    where another user (venkateshwar reddy) has asked a very similar question...
    Jonathan

  • Send table data through mail in oracle 10g

    Hi ,
    I am trying to send a mail through oracle 10g .
    I can send mail through utl_mail .
    The text that I need to send is data from a table .
    The table contains information about all the employees .
    Table name is person . If the employee is absent on any day without any reason there would be a row of this employee in the table person.
    There is also a column named email in this table .
    I need to write a stored procedure which will send the data about each particular employee to their respective email for all the employees in the person table .
    Can anyone please help me on this .
    Thank you.

    Try this forum thread first:
    Re: send email by procedure
    There are lots of articles on how to accomplish this taks on the web:
    -- utl_smtp example
    http://it.toolbox.com/wiki/index.php/Send_email_from_Oracle_Database
    http://www.databasejournal.com/features/oracle/article.php/3423431/Sending-e-mail-from-within-Oracle.htm
    -- From Application Express product
    http://www.oracle.com/technology/products/database/application_express/howtos/howto_workflow.html
    HTH -- Mark D Powell --

  • Problem related to Sending Of Data through SMS/Mail?

    Hi All,
    I want to send my Data to the respective client through Mail/SMS. can I configure my system for that, And If yes than HOW?

    Hi All,
    I want to send my Data to the respective client through Mail/SMS. can I configure my system for that, And If yes than HOW?

  • 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.

  • How to send string data through socket!

    Is there any method to send string data over socket.
    and if client send string data to server,
    How to get that data in server?
    Comments please!

    Thank for your kind answer, stoopidboi.
    I solved the ploblem. ^^;
    I open the source code ^^; wow~~~~~!
    It will useful to many people. I spend almost 3 days to solve this problem.
    The program works like this.
    Client side // string data ------------------------> Server side // saving file
    To
    < Server Side >
    * Server.java
    * Auther : [email protected]
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Server extends JFrame
         private JTextField enter;
         private JTextArea display;
         ObjectInputStream input;
         DataOutputStream output;
         FileOutputStream resultFile;
         DataInputStream inputd;
         public Server(){
              super("Server");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent ev){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display),
                     BorderLayout.CENTER);
              setSize(300, 150);
              show();
         public void runServer(){
              ServerSocket server;
              Socket connection;
              int counter = 1;
              display.setText("");
              try{
                   server = new ServerSocket(8800, 100);
                   while(true){
                        display.append("Waiting for connection\n");
                        connection = server.accept();
                        display.append( counter + " connection is ok.\n");
                        display.append("Connection " + counter +
                             "received from: " + connection.getInetAddress().getHostName());
                        resultFile = new FileOutputStream("hi.txt");
                        output = new DataOutputStream(resultFile);
                        output.flush();
                        inputd = new DataInputStream(
                             connection.getInputStream()
                        display.append("\nGod I/O stream, I/O is opened\n");
                        enter.setEnabled(true);
                        try{
                             while(true){
                                  output.write(inputd.readByte());
                        catch(NullPointerException e){
                             display.append("Null pointer Exception");
                        catch(IOException e){
                             display.append("\nIOException Occured!");
                        if(resultFile != null){
                             resultFile.flush();
                             resultFile.close();
                        display.append("\nUser Terminate connection");
                        enter.setEnabled(false);
                        resultFile.close();
                        inputd.close();
                        output.close();
                        connection.close();
                        ++counter;
              catch(EOFException eof){
                   System.out.println("Client Terminate Connection");
              catch(IOException io){
                   io.printStackTrace();
              display.append("File is created!");
         public static void main(String[] args){
              Server app = new Server();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runServer();
    < Client side >
    * Client.java
    * Auther : [email protected]
    package Client;
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Client extends JFrame
         private JTextField enter;
         private JTextArea display;
         DataOutputStream output;
         String message = "";
         public Client(){
              super("Client");
              Container c = getContentPane();
              enter = new JTextField();
              enter.setEnabled(false);
              enter.addActionListener(
                   new ActionListener(){
                        public void actionPerformed(ActionEvent e){
                             //None
              c.add(enter, BorderLayout.NORTH);
              display = new JTextArea();
              c.add(new JScrollPane(display), BorderLayout.CENTER);
              message = message + "TT0102LO12312OB23423PO2323123423423423423" +
                        "MO234234LS2423346234LM2342341234ME23423423RQ12313123213" +
                        "SR234234234234IU234234234234OR12312312WQ123123123XD1231232" +
                   "Addednewlinehere\nwowowowwoww";
              setSize(300, 150);
              show();
         public void runClient(){
              Socket client;
              try{
                   display.setText("Attemption Connection...\n");
                   client = new Socket(InetAddress.getByName("127.0.0.1"), 8800);
                   display.append("Connected to : = " +
                          client.getInetAddress().getHostName());
                   output = new DataOutputStream(
                        client.getOutputStream()
                   output.flush();
                   display.append("\nGot I/O Stream, Stream is opened!\n");
                   enter.setEnabled(true);
                   try{
                        output.writeBytes(message);
                   catch(IOException ev){
                        display.append("\nIOException occured!\n");
                   if(output != null) output.flush();
                   display.append("Closing connection.\n");
                   output.close();
                   client.close();
              catch(IOException ioe){
                   ioe.printStackTrace();
         public static void main(String[] args){
              Client app = new Client();
              app.addWindowListener(
                   new WindowAdapter(){
                        public void windowClosing(WindowEvent e){
                             System.exit(0);
              app.runClient();

  • Send huge data through the network

    Hi all,
    I need to transfer large image (around 200MB) through the network to the neighborhood PCs for processing. The time i have is very short (Say 4 seconds).
    Since, i need to send the image to multiple PCs, i thought UDP will be helpful. But the LabVIEW UDP vis having limitation of 548 bytes reading for each run. So i need to run in a loop and get the image. Building the string also will be of great memory related task. So the time taken is very high (in the order of minutes). often, i am missing some of the bytes during the operation.
    Then i have tried TCP/IP, planning to send to only one PC. There also when the size is more than 78MB, i am not able to send in single time. Is it so? But i have not seen any limitations in the documents. For 78 MB it take around 18 seconds. But the data is safe.
    The great disadvantage of these two method is, i need to flatten as a string and and rebuild the image in the other end.
    I have tried one more option also, using save as bmp, and read from the network. This work quite better compared to the other two. Time take to transfer 200MB image is 24 seconds ( 5 seconds to save in the same PC + 19 seconds to read through the network). Still it is far from my requirement. One advantage here is, i can read as image datatype it self.
    I have used 100Mps LAN, yes, i can go far 1GPS. Then any other idea how to transfer these huge files in quick manner.
    Thanks,
    Logic

    Hi cc,
    Yes, i was quite clear on that. The point i want to explain is - because of the limitation of the VIs (like 548 bytes for UDP & 78MB for TCP/IP) we are not able to achieve this.
    I need to flatten to string the 200MB image.
    I need to send this in a loop (loop delay may needed to synchronize)
    I need to concatenate at the other end
    Unflatten to image
    Look at the timing i have send in my last mail. Its huge for UDP & TCP/IP
    But the File I/O looks simple and comes closer to your calculation. In my trial i have sent 180 Mega byte image - it took 19 seconds to read from the network PC Harddisk in 100mbps line - which looks good. In a way File I/O also, should do the same (Flatten - read thru network -May be in an ideal way). Anyway, I have left with 2 questions now.
    In File I/O, i need to first write image in to Harddisk of the same PC - that time going to remain the same, any ideas on reducing this? Any chance for without saving into HD - transfer?
    Will it reduce directly 10 times if i go for 1Gbps? (200MB in 2 Secs?) Anything else decides this timing?
    Thanks,
    logic

  • Sending data through network takes forever

    hi fellow java developper
    i'm developping a program that hides files contents trough xml messages in order to exchange securily from a intranet to an extranet whitout having to use ftp and port 21. The problem is it takes over 22 seconds to send a 22k from the server and it takes about 85 seconds to receive it on the client side. this is driving me nuts because i know that delay is extremely high. IS there a way to optimized those to following methods so that the delay is reasonnably cut down
    thanks in advance
    here is my code to send and receive data,
    private BufferedInputStream inBuffer; // input buffer
    private BufferedOutputStream outBuffer; // output buffer
    * Method to send a String to the client
    * @param content is the string to send to client
    public void send(String message) throws IOException
    ByteArrayOutputStream streamOfBytes;
         DataOutputStream insStream_Out;
         streamOfBytes = new ByteArrayOutputStream(message.length());
    insStream_Out = new DataOutputStream(streamOfBytes);
         for (int i = 0; i < message.length(); i++)
              insStream_Out.write((byte)message.charAt(i));
         outBuffer.write(streamOfBytes.toByteArray(), 0,streamOfBytes.size());
         outBuffer.flush();
         * This method permit reception of string messages
         * @param a single character identifying the terminator to avoid receiving garbage
         * @return a string containing the message
         public String receive(char terminal) throws IOException
         char c;
         String message = "";
    long start = System.currentTimeMillis();
    int i = 0;
         while ((c = (char)inBuffer.read()) != terminal)
         message = message + String.valueOf(c);
    i++;
         long end = System.currentTimeMillis();
    System.out.println("temps requis recevoir:" + (end - start) +" ms nbboucle:"+i);
    return message ;
         }

    Hmmm.. there are a few optimization possibilities here, both with respect to creating bytes and retrieving text from bytes again. This is more close to the way java does it, and also the recommended way:// Push data out to a byte[] like this:
    String data; // initialized elsewhere
    ByteArrayOutputStream target = new ByteArrayOutputStream( data.length() );
    DataOutputStream stream = new DataOutputStream();
    stream.writeUTF( data );
    stream.flush();
    byte[] bytes = target.toByteArray();
    // Read data in from an InputStream like this:
    InputStream input; // initialized elsewhere
    DataInputStream stream = new DataInputStream( input );
    StringBuffer result = new StringBuffer();
    try
       // terminates with an EOFException
       // (ridicolous, but that is what the specification says...
       while( true )
          result.append( stream.readUTF() );
    catch( EOFException e )
    return result.toString();However, if your code works, the times you talk about is probably not connected to bad code (unless your XML is really really big) but more likely to network problems. Note that if your output string results in a byte array larger than 65535 bytes, a DataFormatException will be thrown from writeUTF (so the method fails). In that case, you will have to use OutputStreamWriter / InputStreamWriter and specify encoding to be e.g. UTF-8.
    Good luck!
    Daniel

  • Establish connection with database to send/receive data through Xcelsius

    Hi
    Iu2019m working on a Xcelsius project that requires to establish 2 way communication with the SQL server.
    2 way communication requirement: When user selects an option (country) from the accordion component, it needs to send that to database as a query and retrieves that particular country data onto Xcelsius and refresh the chart data accordingly.
    Iu2019m thinking of using ASPX to communicate between Xcelsius and the SQL server, but not sure how to proceed.
    Appreciate if anyone can provide instructions or pointers to where I can get started with it
    Thanks,
    Malik

    Malik,
    I had worked on a similar requirement, where Sql server should be integrated with Xcelsius and should retrieve real time data.
    Here is what we did...
    -->Configured web service on SQL server side (you will find plenty of doc related to this on google)
    -->Configured Web Service connection in Xcelsius (by passing the WSDL url generated from the SQL server)
    -->Developed dashboard in Xcelsius which retrieves data from SQL server realtime i.e. when user passes Variable value through a component (Combo box or anything), then this value in inturn passed to webservice, and then this web service will retrieve the data to Xcelsius.
    Hope this helps...
    -Anil

  • Sending big data through JAXM

    Folks!
    I need to send using SOAP a big message. Big I mean size is unknown,
    sometimes it could be say several gigs.
    I have implemented client program which opens input data as stream
    then piece by piece sends them to server side. Server side as soon
    as receives JAXM message consumes it replies with smth like: OK, FAIL
    Depending on OK/FAIL client sends next part or quits.
    So the questions are:
    1) Does it guaranteed that messages will arrive to server in the same
    order as they were send by client? (I mean server-side implements interface javax.xml.messaging.ReqRespListener - so replies are guaranteed)
    2) Are there any way to handle sending of big data to web service?
    I do suppose that SAAJ provides kind of stream sending/receiving
    through javax.xml.soap.AttachmentPart or it's different thing?
    Please respond.
    Paul

    Did you ever make progress down this line. I am researching how to stream multimedia within a web services infrastructure, so face similar issues to yourself

  • Sending xml data through http services in adobe air

    Hello every one,
    I am stucked with a problem using httpservices,
    Here's my code
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="login();">
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                [Bindable]
                private var reqData:XML = new XML();
                protected function userRequest_resultHandler(event:ResultEvent):void
                    // TODO Auto-generated method stub
                    Alert.show(event.result.toString());                   
                private function login():void
                    trace("username " +username.text)
                    trace("password " +password.text)
                    trace("request"+userRequest.request.toString());               
                     reqData =<ApplicationReq>
                        <InsType>"1"</InsType>
                        <RequestType>"3"</RequestType>
                        <TrackID>"22222222"</TrackID>
                        <Mode>"2"</Mode>
                        <ApplicationID>"11"</ApplicationID>
                        <CompanyID>"1"</CompanyID>
                        </ApplicationReq>
                    var params:Object = {};
                    params["username"] = "admin";
                    params["password"] = "admin@123";
                    userRequest.send();
                    //userRequest.send();
                protected function userRequest_faultHandler(event:FaultEvent):void
                    // TODO Auto-generated method stub
                    Alert.show(event.fault.toString());
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
            <s:HTTPService id="userRequest" url="http://ins.dgsecure.com/gui/xmltest3.php"
                           useProxy="false" method="POST"
                           result="userRequest_resultHandler(event)"
                           resultFormat="xml"  fault="userRequest_faultHandler(event)">
                <s:request xmlns="">                                   
                        <ApplicationReq>
                            <InsType>"1"</InsType>
                            <RequestType>"3"</RequestType>
                            <TrackID>"22222222"</TrackID>
                            <Mode>"2"</Mode>
                            <ApplicationID>"11"</ApplicationID>
                            <CompanyID>"1"</CompanyID>
                        </ApplicationReq>                               
                </s:request>
            </s:HTTPService>
        </fx:Declarations>
        <s:TextInput id="username" x="441" y="160" />
        <s:TextInput id="password" x="442" y="196"/>
        <s:Button x="459" y="244" label="login" click="login()"/>
    </s:WindowedApplication>
    if i set the content type to"application/xml " its giving RPC error, else if the data going to the server through encoding like Xmlrequest = %&ddgG&&ddjkjdj3d
    how to getout of this problem and how can i send the total xml data with http request

    Hi,
    Xcelsius/Dashboards will convert the range of values that you want to send into XML.
    It then will POST the XML when it calls the web page.
    For example, if you had created three ranges to send to your web page:
    A (a single cell)
    B (a single cell)
    C (a row of three cells)
    The data in the POST input stream for the web page will look something like this:
    <data>
      <variable name="A">
        <row>
          <column>10</column>
        </row>
      </variable>
      <variable name="B">
        <row>
          <column>15</column>
        </row>
      </variable>
      <variable name="C">
        <row>
          <column>1</column>
          <column>2</column>
          <column>3</column>
        </row>
      </variable>
    </data>
    I don't have an example for ASP, but I do for a JSP (attached).
    Regards
    Matt

  • How can I send post data through nsurlrequest?

    Hi.
    I'm working on an application which needs to make requests to a php gateway. I tried many examples I found on google, but none of them worked for me.
    First I was working with GET, and it worked just fine, but now, as I need to send more complex data, GET isn't a solution anymore. I have three params to send: module which is a string containing a php class name, method: the function in the class, and params for the function which is usually an indexed array.
    The following method makes the request to the server, but for some reason, doesn't send the POST data. If I var_dump($_REQUEST) or var_dump($_POST), it turns out, the array is empty. Can somebody tell me, what am I doing wrong? Is there some kind of a sandbox, which prevents data from being sent to the? I also tried to send some random strings, which aren't json encoded, no luck. The sdk version is 5.1, and I'm using the iPhone simulator from xcode.
    If it is possible I would like to solve this problem without any additional libraries (like asihttp).
    And here is the code:
    +(NSObject *)createRequest:(NSString *)module: (NSString *)method: (NSArray *)params
        NSString *url       = @"http://url/gateway.php";
        NSData *requestData = nil;
        NSDictionary *data  = [NSDictionary dictionaryWithObjectsAndKeys:
                module, @"module",
                method, @"method",
                params, @"params",
                nil];
        NSString *jsonMessage = [data JSONRepresentation];
        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
        NSString *msgLength = [NSString stringWithFormat:@"%d", [jsonMessage length]];
        [request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
        [request addValue: msgLength forHTTPHeaderField:@"Content-Length"];
        [request setHTTPMethod:@"POST"];
        [request setHTTPBody: [jsonMessage dataUsingEncoding:NSUTF8StringEncoding]];
        requestData     = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
        NSString *get   = [[NSString alloc] initWithData:requestData encoding:NSUTF8StringEncoding];
        NSLog(@">>>>>>%@<<<<<<",get);
    Thank you.

    raczzoli wrote:
    I'm working on an application which needs to make requests to a php gateway. I tried many examples I found on google, but none of them worked for me.
    Why not?
    Unfortunately, you are dealing with a number of different technologies that have been cobbled together over the years. You could write a PHP server that would respond correctly to this request, but not using basic methods like the $_POST variable. PHP was designed for HTML and true forms. What you are trying to do is make it work as a general purpose web service over the HTTP protocol. You can do that, but not with the form-centric convenience variables.
    The following is a basic program that will populate the $_POST variable.
    #import <Foundation/Foundation.h>
    int main(int argc, const char * argv[])
      @autoreleasepool
        // insert code here...
        NSLog(@"Hello, World!");
        NSString  * module = @"coolmodule";
        NSString * method = @"slickmethod";
        //NSArray * params = @[@"The", @"Quick", @"Brown", @"Fox"];
        NSString * params = @"TheQuickBrownFox";
        NSString * url = @"http://localhost/~jdaniel/test.php";
        NSDictionary * data  =
          [NSDictionary
            dictionaryWithObjectsAndKeys:
              module, @"module",
              method, @"method",
              params, @"params",
              nil];
        //NSString *jsonMessage = [data JSONRepresentation];
        //NSData * jsonMessage =
        //  [NSJSONSerialization
        //    dataWithJSONObject: data options: 0 error: nil];
        NSMutableArray * content = [NSMutableArray array];
        for(NSString * key in data)
          [content
            addObject: [NSString stringWithFormat: @"%@=%@", key, data[key]]];
        NSString * body = [content componentsJoinedByString: @"&"];
        NSData * bodyData = [body dataUsingEncoding: NSUTF8StringEncoding];
        NSMutableURLRequest * request =
          [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString:url]];
        //NSString * msgLength =
        //  [NSString stringWithFormat: @"%ld", [jsonMessage length]];
        NSString * msgLength =
          [NSString stringWithFormat: @"%ld", [bodyData length]];
        [request
          addValue: @"application/x-www-form-urlencoded; charset=utf-8"
          forHTTPHeaderField: @"Content-Type"];
        [request addValue: msgLength forHTTPHeaderField: @"Content-Length"];
        [request setHTTPMethod: @"POST"];
        //[request setHTTPBody: jsonMessage];
        [request setHTTPBody: bodyData];
        NSData * requestData =
          [NSURLConnection
            sendSynchronousRequest: request returningResponse: nil error: nil];
        NSString * get =
          [[NSString alloc]
            initWithData: requestData encoding: NSUTF8StringEncoding];
        NSLog(@">%@<",get);
      return 0;
    I have written this type of low-level server in PHP using the Zend framework. I don't know how to do it in basic PHP and wouldn't bother to learn.
    Also, you should review how you are sending data. I changed your example to send the appropriate data and content-type for the $_POST variable. If you had a server that could support something else, you could use either JSON or XML, but your data and content-type would have to match.

  • Sending file data through a buffer

    Hi there, I am new to using sockets, file/buffered input/output streams etc.
    What I want to do is create an application that listens on a port for (a request) from a remote host on a socket. It should receive the request as a string.
    Now lets say the request is for a file, so it expects the string request to be the file name;
    Say when the request comes in, the string would be something like this
    Request = �myfile.txt�
    Now the application will need to interpret that string and find the file, �myfile.txt� from a specific directory, and first send a string back (to the remote host) such as �sending myfile.txt�, followed by the actual file itself. The file would need to be buffered so that it does not cripple the network.
    I have not got a clue how to do this successfully, so any help would be much appreciated.
    Thanks.

    The [url http://java.sun.com/docs/books/tutorial/]Custom Networking tutorial has a section on using sockets within a Client/Server context.

Maybe you are looking for

  • Embedded movies won't show up

    I noticed this problem when a friend of mine directed me to a site with an embedded movie object: http://psubuntu.com/installation-instructions/ There are a few issues here: 1. If I look at this site in IE7, it shows up with a red "x" icon for the re

  • Problem in loading transactional data from to 0MKT_DSO1(ods) to 0MKTG_C01

    Hi, I am trying to load lead transaction data to the standard Crm lead management cube from ODS.There is a problem while loading transaction data from 0MKT_DSO1(ods) to the infocube 0MKTG_C01 as the field 0STATECSYS2(CRM STATUS)  is set to 10 in ods

  • MSS: Cost Center in Team Viewer

    I'm trying to add Cost Centres to the Team Viewer.  I put 'ORG_COSTC' with Function Module HRWPC_GEN_COL_COSTCENTER into V_TWPC_ACOL_C and assigned the column group to my view.  I managed to get the Cost Centre column to show up on the Team Viewer bu

  • Sending email from BSP

    Hi, In my project, I have a task that after clicking a button say "SendEmail", mail has to be sent to the customer. How can I do this?? Any ideas plz.... Thanks, Ravindra.

  • Magnifying glass search field versus initial characters scroll.

    I don't want to use the "magnifying glass" search field in iTunes window. I prefer to type the first few characters and iTunes scrolls there. With most recent update, I can no longer do this. Any advice on disabling the magnifying glass? (Previously,