combining OpenGL and TCP/IP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • synapticleft
    New Member
    • Apr 2007
    • 2

    combining OpenGL and TCP/IP

    hi all -
    I just started working with all this so my terminology may be bad.
    Im using VC++ with winsock2.h and glut.h
    A piece of software is outputting a signal via TCP/IP; I initialize a socket and can read data from it by using recv() within a while loop.
    however, when I put the data acquisition code within the display loop of an openGL function, the data acquisition stalls. I think this is because the server is sending data faster than the client can receive so it stops. I was thinking of perhaps using an asynchronous implementation where the TCP/IP data is retrieved by a function running in parallel with the display loop. Do you happen to know a way of doing this? It seems like there are similar mechanisms used within the OpenGL loop to get input from the keyboard, which suggests to me that the GLUT display loop isnt blocking the main function.. is this true?
  • nmadct
    Recognized Expert New Member
    • Jan 2007
    • 83

    #2
    Sounds like you do want to use asynchronous sockets.


    I can't answer the question about OpenGL, maybe someone else can.

    Comment

    • horace1
      Recognized Expert Top Contributor
      • Nov 2006
      • 1510

      #3
      in such data acquisition applications I would use threads with one thread acquiring the data, putting it into a buffer and setting an event - another thread waits for an event, extracts the data and displays it. You can still have the problem that you may be unable to display all the data (depends how fast you are acquiring, spped of displaying data, etc)

      Comment

      • synapticleft
        New Member
        • Apr 2007
        • 2

        #4
        thanks.
        If i increase the buffer length of the argument i pass recv(), i can prevent the connection from being dropped. there is still a little stuttering in the graphics, i presume from when the program is waiting for recv() to complete, so ill look into threads and asynchronous sockets. Though I do not know if it will work if the server, which i cannot modify, is set to synchronous.

        Gautam

        Comment

        Working...