Home > other >  Java and c + + Socket communication, meet PIPE anomalies (Broken PIPE), seeks to solve
Java and c + + Socket communication, meet PIPE anomalies (Broken PIPE), seeks to solve

Time:11-02

Recently doing android development project, the Client side to run on android Java program, the Server end to run the c + + program in VC 6.0, when send data can be sent to the Server for the first time, but when the second using the Write () send data to the Server, a "Broken pipe", point to solve the advice please??????? The code is as follows:
Private an OnClickListener SendClickListenerClient=new an OnClickListener () {

@ Override
Public void onClick (View arg0) {

HandPaint. Dump ();
//Byte b0=0;
If (isConnecting & amp; & MySocket!=null)
{
String msgText=HandPaint. GetPoints (). The toString () + END;//in the edit box, we input the content of the
If (msgText. Length () & lt;=0)
{
Toast. MakeText (mContext, "send content cannot be empty!" , Toast.LENGTH_SHORT).show();
}
The else
{
Try
{
Out. Write (GetStringLength (msgText length () + 1));
Out. Write (msgText getBytes ());
//the out. Write (b0);//
//the out. Write (short2byte (0));
out.flush();

}
The catch (Exception e)
{
//TODO: handle the exception
Toast. MakeText (mContext, "send exception:" + um participant etMessage (), Toast. LENGTH_SHORT), show ();
}



}
}

CodePudding user response:

Your problem solved now
  • Related