FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Network library

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
maustin



Joined: 15 Jun 2009
Posts: 10

PostPosted: Mon Jun 15, 2009 11:57 pm    Post subject: Network library Reply with quote

Well, I tried writing a socket proxy via pipes - it worked in my test code, but not within the full application. Anyway, since Tango has network support, would it be simple to add networking to minid? Jarrett? :)

Nothing fancy, something along the lines of...

Code:
namespace net
{
    function inoutSocket() { }

    class Socket : InoutStream
    {
        function rawRead() { }
        function readln() { }
    }
}

local socket = net.inoutSocket( "irc.freenode.net", 8001 )
// implicit socket.connect()?
socket.setTimeout( 0.001 )
local buffer = Vector( "u8", 4096 )

socket.write( "user maustin2 0 0 :Mike Austin\r\n" )
socket.write( "nick maustin2\r\n" )

while (true)
{
    local buffer, length = socket.rawRead( 4096, buffer )

    if (length > 0)
        writeln( buffer )
   
    time.sleep( 1.0 )
}

I'm itching to write an IRC client for minid-inertia, a Windowing System and UI Framework. http://mike-austin.com/inertia/minid/minid-inertia-2.png

Mike
Back to top
View user's profile Send private message
maustin



Joined: 15 Jun 2009
Posts: 10

PostPosted: Tue Jun 16, 2009 12:01 am    Post subject: Related Tango example Reply with quote

http://www.dsource.org/projects/tango/wiki/SocketHelloExample
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Tue Jun 16, 2009 10:36 am    Post subject: Reply with quote

Yes. Smile
Back to top
View user's profile Send private message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Tue Jun 16, 2009 2:20 pm    Post subject: Reply with quote

Ooooh. Depending on how it turns out, I could have use for this also. Any chance of getting Selectors available as well?
_________________
Chris Nicholson-Sauls
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Tue Jun 16, 2009 4:20 pm    Post subject: Reply with quote

That could be in the cards. I think I'll just try getting the basic sockets in first and then work on adding more features.
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Thu Jun 25, 2009 3:29 pm    Post subject: Reply with quote

I haven't been doing nothing about this Razz

I was using Tango 0.99.8, but the problem with that is that its socket implementation doesn't support timeouts on anything other than reads. Also, the tango.net package is getting some reorganization and simplification post-0.99.8, and I don't want to write a library that's based on stuff that has already been obsoleted.

I thought Tango trunk had an issue whereby timeout-capable operations weren't yet implemented on Linux, which seemed like a big problem (and would obviously make it useless for maustin), but I now realize that it's only the operations that are part of the new auto-IO-fiber-scheduling stuff that are unimplemented. Normal timeout reads/writes are supported. (Oddly not connects, even though they can be done asynchronously.)

So now that I've updated the code to Tango trunk, I'll work on it for reals Razz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group