Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - matmatmat

1
RPG Maker Scripts / Re: RGSS3 TCP/IP implementation
March 17, 2020, 05:03:50 am
I know that this point is really old, but I was looking at the same tutorial as you and getting the same error, I did a bit of googling and by pure luck I found out what the problem was.

It turns in C, errno returns a value of 0 if no error has occurred. To solve this was extremely simple:

def self.check
    errno = Winsock.WSAGetLastError
   
    if errno == 0
      return
    end
   
    constName = Errno.constants.detect {|c| Errno.const_get(c).new.errno == errno }   
   
    if constName
      raise Errno.const_get(constName)
    else
      raise "Unknown network error code: #{errno}"
    end
  end