Jump to content

  • Log In with Google      Sign In   
  • Create Account


Saoblol

Member Since 23 Mar 2012
Offline Last Active Mar 22 2013 03:47 AM
-----

Topics I've Started

TCP messages not being sent

22 August 2012 - 01:41 AM

Hi

I am currently working on a project that involves a server and multiple clients that can connect to it and request data. Im sending messages (strings) from the client to the server and vice versa (never between clients), but sometimes they dont get sent but are stuck until I try to send it again, and then both messages are sent at the same time. At first this seemed easy to solve: the packets are automatically stored until there is enough data to send out in order to save bandwith (aka Nagle algorithm), so setting tcpclient.NoDelay = true should do the trick, but it didnt. I've tried to solve this for days now, but can't get any progress on it.

Im using a BinaryWriter for sending data, and also tried the tcpclient.Client.Send(byte[]) method with the same results.

public Client()

{

this.tcpClient = new TcpClient();

this.tcpClient.NoDelay = true;

this.outgoingMessages = new List<string>();

}





/// <summary>

/// Write pending messages to the server.

/// </summary>

private void Write() //This is running in a thread

{

while (true)

{

lock (this.outgoingMessages)

{

if (this.binaryWriter != null && this.outgoingMessages.Count > 0)

{

this.binaryWriter.Write(this.outgoingMessages[0]);

this.binaryWriter.Flush();

this.outgoingMessages.RemoveAt(0);

}

}

Thread.Sleep(33);

}

}


Hopefully someone knows an answer to this smile.png

SlimDX and WPF issue

07 July 2012 - 10:10 AM

Hi, I'm currently switching my project from WindowForms to WFP, but I'm having problems with rendering into an WPF Image Control.

This is what I do to get the Handle of the Image Control, but instead the scene is rendered across the whole window, not just the specified Image area

[source lang="csharp"]static void InitializeTileEditor() { WaterScene scene = new WaterScene(); window = new MainWindow(); window.Show(); HwndSource source = (HwndSource)HwndSource.FromVisual(window.image_Viewport); //IntPtr viewportHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle; VEngine.Initialize(window, source.Handle, 1280, 720, 60, true); VEngine.Run(scene); }[/source]

I tried two ways of acquiering the handle, but both had the same result.

Any Ideas how I get the exact handle of the Image Control?

Edit: The handle will be used in the 3D Intialization of SlimDX to create the factory

[source lang="csharp"]factory.SetWindowAssociation(viewportHandle, WindowAssociationFlags.IgnoreAll | WindowAssociationFlags.IgnoreAltEnter);[/source]

PARTNERS