Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: beginner questions =/  (Read 4837 times)

0 Members and 1 Guest are viewing this topic.

hacky

  • Newbie
  • *
  • Posts: 26
    • View Profile
beginner questions =/
« on: October 22, 2009, 10:59:28 pm »
hey guys
im making my first steps on network programming so please help me a bit :o

yeah i managed a server who can have more than 1 client and can recieve data via selector. is it possible with the selector to make my main ingame loops(like drawing graphics and gameplay) on the client and also recieving data from the server with the selector? or do i need threads?  :?

regards

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
beginner questions =/
« Reply #1 on: October 23, 2009, 02:23:21 am »
Instead of a separate thread you can also set your socket to non-blocking and check for data at every loop cycle.

However using a separate thread has some benefits. So if you're not scared of using one, try it. :)

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
beginner questions =/
« Reply #2 on: October 23, 2009, 11:08:57 am »
Listen Function isn't a blocking one? If so you need one thread to listen to new clients call and one to send/receive data to/from the clients.
SFML / OS X developer

hacky

  • Newbie
  • *
  • Posts: 26
    • View Profile
beginner questions =/
« Reply #3 on: October 23, 2009, 12:33:59 pm »
Quote from: "Tank"
Instead of a separate thread you can also set your socket to non-blocking and check for data at every loop cycle.

However using a separate thread has some benefits. So if you're not scared of using one, try it. :)

im a bit scared, but i will try it

Quote from: "Hiura"
Listen Function isn't a blocking one? If so you need one thread to listen to new clients call and one to send/receive data to/from the clients.
nah, the server is working fine! i mean the client where i have to loop the game and also recieve data from server

 

anything