Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Oct 2006
Offline Last Active Feb 21 2012 03:50 AM

Posts I've Made

In Topic: Network bottle neck?

09 February 2012 - 04:21 PM

select()/recv() is usually called from the main thread, not a separate thread.

But if I call select from the main thread, wont that block my render loop? I thought the point of select was you could let it set in the background on a separate thread until data arrived, which you then bubbled back up to the main thread somehow

In Topic: Network bottle neck?

09 February 2012 - 03:46 AM

How fast is a frame?
Have you disabled Nagle?

Havent got timing information yet, But disabling nagle seemed to do the trick. Though theres still lag there which I dont think should be there. Im comparing network performance to something like synergy or sharemouse which seem to do basically the same thing.

Non-blocking I/O is generally not what you want. You want to use select() and recv()/send(). Or you want to use platform-specific asynchronous I/O, such as I/O completion ports on Windows, or evented I/O on Linux, or similar.

So far non-blocking does the trick. I have to update as fast as possibly anyway, plus 90% of the time there will be data to read each frame anyway. Would I gain much performance using select asynchronously? Then at the start of each frame I could just read from a buffer rather than doing a recv. Or is that effectively what recv is? Then id have to manage data transfer from the select() thread back to the main render thread :S Scary. Especially if I increase the number of clients I want.

Network programming is hard!

Im just doing this over a wireless using a phone rather than through a carrier network.

Any other tips to speed things up???

In Topic: Network bottle neck?

08 February 2012 - 06:13 PM

I should also point out, the client is running on an iphone, and the server is on a windows box, so server is using winsock, and client is using bsd

In Topic: Network bottle neck?

08 February 2012 - 06:11 PM

I havent measured times exactly yet as I just got it up and running last night.

I havent disabled nagle either.

Ill try these things tonight.

After reading a bit, it sounds like UDP might be more suitable as I require fast response times.

But is it really necessary, or should I be able to get reasonable 1:1 motion using tcp?

In Topic: Simple GUI suggestions

07 February 2012 - 06:22 PM

class UIObject
void HandleMouseClick(int x, int y, int button)
void HandleMouseMove(int x, int y)
void Draw();

int x, y, width, height

UIObject[] objects

//On mouse click somewhere in your code
foreach UIObject o in objects

//On mouse movesomewhere in your code
foreach UIObject o in objects

//OnDraw somewhere in your code
foreach UIObject o in objects

Your button and text ui object would inherit from UIObject and override the handle methods. You could then raise specfic events in your derived classes that relate to that type of ui object, eg scroll bar could have 'onscroll', button could have 'onclick'.