android - how to pass some data as a parameter like http parameter in socket? -


I'm using Android 1.6 There are some applications in my office that are available for the HTTP posting method. Sends some data through the medium.

I want to send data through a socket to a module. I send the data correctly through the socket (output stream). It receives the Server Side (C # Socket Application) socket app properly.

But some of the data in the HTTP post method are passed as parameters. I can not find any method to send some data to the socket as a parameter and some data in the stream.

The following are the codes that I have done to send data through the socket through the output. socket = new socket (this.ipAddress, this.port_number); //socket.setSocketImplFactory (fac) Log.i (tag name, "after creating sokcet"); OS = socket.getOutputStream (); Is = socket.getInputStream (); Dos = new data overputstream (OS); Logs. I (tagname, "after creating the output stream"); Dis = new DataInputStream (is); Logs. I (tagname, "after creating the input stream"); //dos.writeUTF (msg [i] .trim ()); . //dos.write(msg[i].trim () getBytes ()); //dos.writeUTF (msg [i] .trim ()); Dos.write (msg [i] .trim () getBytes ().); // data written in the form of bytes //dos.writeUTF (str) dos.flush (); Log.i (tagname, "after writing data"); Stringbuilder sbuilder = new stringbilder (); /// * int ch; Byte BT = 1; While ((BT = (byte) dis.read ())! = - 1) {Log.i (tagname, "ch =" + bt); Byte temporary [] = new byte [1]; // temporary [0] = (byte) ch; Temporary [0] = (byte) bt; String tempStr1 = new string (temporary); Logs. I (tagname, "temprist:" + tempus 1); Sbuilder.append (tempStr1); Logs. I (tagname, "data from server:" + sbuilder.toString ()); TempStr1 = null; } // * / // byte tt [] = new byte [dis.readline ()] //resultStr=dis.readLine (); ResultStr = resultStr.trim (); ResultStr = sbuilder.toString (); Logs. I (tagname, "server res:" + as a result); If (dos! = Null) {try {dos.close (); } Hold (exception before) {}} if (dis! = Null) {try {dis.close ()}} hold (exception before) {}} if (socket! = Null) {try {socket.close ()} } Catch (Exception Pre) {}}

The above coding snippet works properly.

But in the HTTP post method, I want to send parameters in the username and password and streams in the username and password streams as parameters and actual data, such as the parameters.


I look for solutions.
We can not send data in the form of parameters such as HTTP parameters in socket connections.
We can only send data in currents. In the server side we can write to parse the data from the stream.

Thanks

Comments