View previous topic :: View next topic |
Author |
Message |
maustin
Joined: 15 Jun 2009 Posts: 10
|
Posted: Mon Jun 15, 2009 11:57 pm Post subject: Network library |
|
|
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 |
|
|
maustin
Joined: 15 Jun 2009 Posts: 10
|
|
Back to top |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Tue Jun 16, 2009 10:36 am Post subject: |
|
|
Yes. |
|
Back to top |
|
|
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Tue Jun 16, 2009 2:20 pm Post subject: |
|
|
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 |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Tue Jun 16, 2009 4:20 pm Post subject: |
|
|
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 |
|
|
JarrettBillingsley
Joined: 20 Jun 2006 Posts: 457 Location: Pennsylvania!
|
Posted: Thu Jun 25, 2009 3:29 pm Post subject: |
|
|
I haven't been doing nothing about this
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 |
|
Back to top |
|
|
|