I created obex object push and start it. Then i refer the code in help file to send message to service, the code is:
private void writeToStream(System.IO.Stream selectedStream, string textToWrite)
if(selectedStream != null)
char charWrite = textToWrite.ToCharArray();
byte byteWrite = new byte[charWrite.Length];
for(int inx = 0; inx < charWrite.Length; inx++)
byteWrite[inx] = (byte) charWrite[inx];
selectedStream.BeginWrite(byteWrite, 0, byteWrite.Length, new AsyncCallback(writeCallback), selectedStream);
MessageBox.Show("Select a session first");
private void writeCallback(IAsyncResult result)
System.IO.Stream selectedStream = (System.IO.Stream) result.AsyncState;
// EndWrite() must always be called if BeginWrite() was used!
But one service, it throws exception in header of received packet.
Please help me!!!. Thanks