network/socket/tcp read/write class ?

About Monkey 2 Forums Monkey 2 Programming Help network/socket/tcp read/write class ?

Tagged: , ,

This topic contains 6 replies, has 3 voices, and was last updated by  gcmartijn 2 years, 7 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #3945

    gcmartijn
    Participant

    I’m searching for the most easy socket class for localhost debugging only at the moment.

    So one window has
    socket.connect(‘127.0.0.1’) (localhost)
    if newdata then
    data.read()
    end

    and the other window ‘server’ has
    createconnection()
    data.send(“bla”)

    Target os at the moment just OSX

    can’t find a easy way at the moment.

    #3949

    Simon Armstrong
    Participant
    #3951

    Mark Sibly
    Keymaster

    ipv6 socket support for mx1 has just reared it’s ugly head again, so I think I’ll get stuck into this right now!

    #3955

    gcmartijn
    Participant

    @Simon Armstrong

    Will check if I can use it, thanks

    #3958

    Simon Armstrong
    Participant
    #3959

    Mark Sibly
    Keymaster

    Just commited the ‘official’ std.socket.Socket and std.socket.SockerServer classes.

    Very similar to Si’s work except:

    • Only Read( ptr,count) and Write( ptr,count ) IO supported for now. Socket extends Stream so the intent is to add ReadString/WriteString etc to Stream.
    •  If called from a fiber, socket ops including connect, listen, accept, close, read and write are performed on a thread while the fiber suspends itself, ie: they wont lockup the gui. Lots of room for improvement in the implementation here (and there are vsync issues), but it makes client/server stuff about 10000 easier to write than in mx1 (see new echoserver banana).
    • Only ‘stream’ sockets for now. Connection oriented datagrams should be very easy to add, connection-less will require more work, but are these even used any more? I think something WebSocket-ish (ie: a message/reply based protocol) should be next up!
    • Should be completely ipv6 friendly.

    Basically, it’s a WIP first attempt. The ‘new’ ipv6 friendly way to do sockets is much nicer to work with though.

    #3976

    gcmartijn
    Participant

    @Mark

    I wait till there is a little info about it in module docs

     

    Edit:

    Well the banana did give all the things I need yet, so no docs needed at the moment 🙂

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.