freebasic.net Forum Index
FreeBASIC's Official Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in

chiSock FB socket library for Win/Lin
Goto page 1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    freebasic.net Forum Index -> Projects
View previous topic :: View next topic  
Author Message
cha0s
Site Admin
PostPosted: Jun 02, 2007 17:06    Post subject: chiSock FB socket library for Win/Lin Reply with quote

Download Source: http://therealcha0s.net/project/chisock%2008-24-08.zip

Compiling and API info in the README.txt.


Last edited by cha0s on Aug 24, 2008 7:41; edited 4 times in total
 
Back to top
View user's profile Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
zerospeed

PostPosted: Jun 03, 2007 16:51    Post subject: Reply with quote

cha0s, good implementation!

Have you thought about event-driven sockets? (callback based). I have a draft laying around, but never finished (ala get it fully working, neither cross-platform) :-P

Later.
 
Back to top
View user's profile
cha0s
Site Admin
PostPosted: Jun 03, 2007 18:05    Post subject: Reply with quote

Thank you. It's possible but I prefer this interface ;)

socket-???-thread.bas would be easy to have as a launch point for callbacks.
 
Back to top
View user's profile Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
{Nathan}
Sr. Member
PostPosted: Jun 04, 2007 1:05    Post subject: Reply with quote

I downloaded the archive 3 times and tried to untar it, but all times it was unsuccesful and did not extract. Can you try reupping and rearchiving please?
 
Back to top
View user's profile Visit poster's website AIM Address Yahoo Messenger MSN Messenger
D.J.Peters
Guru
PostPosted: Jun 04, 2007 1:19    Post subject: Reply with quote

link removed

Last edited by D.J.Peters on Jun 04, 2007 20:26; edited 1 time in total
 
Back to top
View user's profile Visit poster's website
{Nathan}
Sr. Member
PostPosted: Jun 04, 2007 20:25    Post subject: Reply with quote

Got it DJ -- thanks. You can remove it now.
 
Back to top
View user's profile Visit poster's website AIM Address Yahoo Messenger MSN Messenger
rmann05

PostPosted: Jun 05, 2007 3:11    Post subject: Reply with quote

{Nathan} wrote:
I downloaded the archive 3 times and tried to untar it, but all times it was unsuccesful and did not extract. Can you try reupping and rearchiving please?

Try renaming the file to chisock-6-2-07.tar.zip instead of chisock-6-2-07.zip.tar. After I did that, I could unzip the file on my Linux server.
 
Back to top
View user's profile Visit poster's website
cha0s
Site Admin
PostPosted: Jun 05, 2007 6:57    Post subject: Reply with quote

Yeah, it's a zip file not a .tar.gz...
 
Back to top
View user's profile Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
attacke

PostPosted: Jul 08, 2007 19:14    Post subject: Reply with quote

umh, iv tried to make this simple irc connection with this socket library...

after some whiles i notice that something takes $%#@ of memory...
while running my pagefile are at 1.5gig.
as soon as i close the program it goes down to 200mb

heres the code.

Code:
#include "socket.bi"
Const crlf = Chr(13)+Chr(10)

Dim As chi.socket so
Dim As String st

If ( so.client("se.quakenet.org",6667) <> chi.SOCKET_OK ) Then
        Print "socket Error!"
Endif

so.put("NICK Blarfen"+crlf)
so.put("USER blarfen """" ""se.quakenet.org"" :Blarfen rockar fett"+crlf)

Do
        If( so.get( st, , , TRUE ) ) Then
                so.dump_data( Len(st) )
                Print st;
        End If
        st = ""
        Sleep 100
Loop Until MultiKey(&h01)

so.close()


the funnt part are that i aint getting any data back. but i see it in my firewall that there are like 400bytes both incomming and outgoing.
 
Back to top
View user's profile Visit poster's website
cha0s
Site Admin
PostPosted: Jul 08, 2007 22:31    Post subject: Reply with quote

Yeah, I have to adjust the buffer allocation, i made it way too high when i was experimenting. I'll work on it eventually, but probably not today...
 
Back to top
View user's profile Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
cha0s
Site Admin
PostPosted: Jul 11, 2007 14:04    Post subject: Reply with quote

I see now what you're doing, you're reading strings, but the way my library works, is that if you send a string, first you send one integer that says how long the string is, and then the string data. So the same happens when reading. You're reading a random integer (maybe like 1721827398 :P), and then allocating a string to that length, which is wrong.

TODO: add a 'get_all' function which retrieves everything in the buffer into a string. And a 'put_all' too, for completion
 
Back to top
View user's profile Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Pritchard
Guru
PostPosted: Jul 11, 2007 14:20    Post subject: Reply with quote

Thanks, cha0s! This clears some things up for me :D
 
Back to top
View user's profile Send e-mail
attacke

PostPosted: Jul 23, 2007 20:19    Post subject: Reply with quote

oh... well ill give it another go.
 
Back to top
View user's profile Visit poster's website
Oz
Sr. Member
PostPosted: Sep 15, 2007 22:34    Post subject: Reply with quote

Hey, cha0s

I'm using the latest version of your library in an attempt to remake OzBOT, but I can't get data. You had mentioned something a few posts above, but from my understanding, it's a problem with chi-sockets....

here is how i'm trying to get a line from the irc server:

Code:
Function irc_sock.getLine( Byref returnStr As String ) As Integer

        Dim getBuffer(0 To 1) As Ubyte

        While this.socketInside.get_data( @getBuffer(0), 1, FALSE ) = TRUE
                If Right( returnStr, 2 ) <> Chr( 10, 13 ) Then
                        ? Chr( getBuffer(0) );
                        returnStr &= Chr( getBuffer )
                Else
                        ?
                       
                        Return TRUE
                End If
                getBuffer(0) = 0
                getBuffer(1) = 0
        Wend

        Return FALSE

End Function


this method does not work, sadly.

any suggestions?

Oz~
 
Back to top
View user's profile Send e-mail
cha0s
Site Admin
PostPosted: Sep 16, 2007 2:18    Post subject: Reply with quote

Should be chr( getbuffer(0) ), also, it's chr(13, 10).
 
Back to top
View user's profile Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    freebasic.net Forum Index -> Projects All times are GMT
Goto page 1, 2, 3, 4, 5  Next
Page 1 of 5

 
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



sf.net phatcode