最近在做android開發專案,Client端為運行在android上的java程式,Server端為運行在VC 6.0上的C++程式,當第一次向server發送資料可以發送,但當第二次用Write()向server發送資料時,出現“Broken pipe”。請各位提點解決的建議???相關代碼如下:
private OnClickListener SendClickListenerClient = new OnClickListener() {
@Override
public void onClick(View arg0) {
HandPaint.dump();
// Byte b0=0;
if ( isConnecting && MySocket!=null)
{
String msgText = HandPaint.getPoints().toString()+END;//取得編輯框中我們輸入的內容
if(msgText.length()<=0)
{
Toast.makeText(mContext, "發送內容不能為空!", Toast.LENGTH_SHORT).show();
}
else
{
try
{
out.write(GetStringLength(msgText.length()+1));
out.write(msgText.getBytes());
//out.write(b0);//
// out.write(short2byte(0));
out.flush();
}
catch (Exception e)
{
// TODO: handle exception
Toast.makeText(mContext, "發送例外:" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
uj5u.com熱心網友回復:
你的問題現在解決了嘛轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/148174.html
標籤:網絡通信
上一篇:IOCP GetQueuedCompletionStatus 錯誤121
下一篇:Markdown基本語法
