Receive String - DirectPlay

From: Reiter Peter (reiter_peter_at_gmxDOTat)
Date: 02/23/04

Date: Mon, 23 Feb 2004 17:04:44 +0100


i need to make my application able to receive a string from a network
i use for this P2P with DirectPlay

I modified the P2P example by tom miller's book
here's the OnDataReceive event:
private void OnDataReceive(object sender, ReceiveEventArgs e)


string temp = e.Message.ToString();


NetworkPacket np = new NetworkPacket();

byte[] temp1 = np.GetData();

for(int i = 0; i < temp1.Length; i++)


this.BeginInvoke(new AddTextCallback(AddText), new object[] {
temp1[i].ToString() });





// everything above this comment is from me, the rest is from the book

string newtext = string.Format

("Received message from DPlay UserId: 0x{0}",


this.BeginInvoke(new AddTextCallback(AddText),

new object[] { newtext });


Can you please help me, because i have no idea how to continue


Relevant Pages

  • Re: Insert string on RTF TextBox after Drag and Drop
    ... it was dropped (in the text that's already in RTF Textbox, ... It would make no sense for the drag-and-drop API itself to have anything that would help map cursor coordinates to text insertion points. ... I would like to insert the dropped string just at the point of the RTFTextBox I point with the mouse when dropping the string. ... string newText = e.Data.GetData); ...
  • Re: After being send through socket string is corrupted
    ... > string to a server. ... Most likely rcvBuffer is longer than the actual received message. ... really should specify a character encoding whenever you convert from ... String to byteor vice versa. ...
  • Re: Insert string on RTF TextBox after Drag and Drop
    ... GetCharIndexFromPositiongives me a value superior by 3 of that ... I'm sure I don't know what that reason actually might be. ... string newText = e.Data.GetData); ...