I've been trying to get my head around Blitz Max's socket programming of late, and i'm getting very confused with it. I have a very procedural approach to programming, I dont much hold with OO and because of that i'm struggling with the stuff in the code archives.
I'm very good with Blitz3D's networking, I can use either UDP or TCP, assemble my streams byte by byte, close connections, send / receive messages - i've written everything from a multi-threaded web server to games to server management tools to game mods and even once a multi-player game 'AI' that connected to multiplayer LAN games.
But BlitzMax... *boggle*
I've hunted for tutorials, experimented, and read through the code archives and i'm still stuck! I can't seem to fathom out the basic concept of sockets.
As far as I can figure out I create a socket, and then I bind the socket to a port (which begs questions about why I need to create the socket in the first place, but i'm sure it's logical to somebody more knowledgeable than me).
On the server I then repeatedly check socketListen on the socket to see if data has arisen, or should this be the bound socket?
Once a connection is detected it returns a new socket for that connection, so I bind that socket to a stream with createSocketStream, and I then read off that data with readShort/Int/Line etc, and check for more available content with SocketReadAvail() I think, although maybe I need a stream command for that.
On the client side I create a socket, bind it to the send port, then I connect it to the remoteIP and the receive port at the other end, which creates a new socket.
I then bind a stream to the new socket and write data to it with writebyte/int/line - but how do I send this stream?
I'm so confused by all of this, but I want to learn. I really dont want to use networking libraries because I want to master it for myself, but i'm so confused !
Is there a tutorial on network coding in BlitzMax anywhere?
Help please. I'm too stupid to figure this out.
I'm very good with Blitz3D's networking, I can use either UDP or TCP, assemble my streams byte by byte, close connections, send / receive messages - i've written everything from a multi-threaded web server to games to server management tools to game mods and even once a multi-player game 'AI' that connected to multiplayer LAN games.
But BlitzMax... *boggle*
I've hunted for tutorials, experimented, and read through the code archives and i'm still stuck! I can't seem to fathom out the basic concept of sockets.
As far as I can figure out I create a socket, and then I bind the socket to a port (which begs questions about why I need to create the socket in the first place, but i'm sure it's logical to somebody more knowledgeable than me).
On the server I then repeatedly check socketListen on the socket to see if data has arisen, or should this be the bound socket?
Once a connection is detected it returns a new socket for that connection, so I bind that socket to a stream with createSocketStream, and I then read off that data with readShort/Int/Line etc, and check for more available content with SocketReadAvail() I think, although maybe I need a stream command for that.
On the client side I create a socket, bind it to the send port, then I connect it to the remoteIP and the receive port at the other end, which creates a new socket.
I then bind a stream to the new socket and write data to it with writebyte/int/line - but how do I send this stream?
I'm so confused by all of this, but I want to learn. I really dont want to use networking libraries because I want to master it for myself, but i'm so confused !
Is there a tutorial on network coding in BlitzMax anywhere?
Help please. I'm too stupid to figure this out.