sync send data at photon server?

Options
zhaoway
edited August 2014 in Photon Server
hi, I have study photon at a while. As we know, application recevied data by asyn way. But, user Application call SendResults Send() function of IPhotonPeer, it have return value SendResults, which did mean that sending data is sync ?
I also notice that ISocketSender at ExitGames.Net.Sockets have function: void Send(byte[] data), which also seem sync call. For example, UdpSender use UdpClient by send function. Because photon server is multithread, can we think it is not so bad? If many fiber use thread pool, sync sending data may block server at high system loading.

Comments

  • [Deleted User]
    Options
    Hello,

    no, that is not corrected, the sending is not synchronous.

    The SendResult tells you if the data was written to the socket successfully. For example, you get a "failure" immediately if the send queue is full, if the client is disconnected etc.. The Send method returns immediately after the data is written to the socket, it does not wait until the data is actually transmitted to the client.
    It is not synchronous, and a SendResult = OK does not mean that the client has received the data (especially not for unreliable UDP!), it only means that there was no "obvious" error that prevented the peer from sending at all.
  • zhaoway
    Options
    Hello,
    what I mean is: if sendResult may be blocked by OS because of some reasons, such as write buffer full. Even though it happen not often at common, we must think at high system loading. If sendResult call is blocked by OS, its thread will be stalled.
  • If buffers are full etc., you will receive a send result that tell's you that there was an error. The Send() function does not get stalled.