
FreeBASIC's Official Forums
|
| View previous topic :: View next topic |
| Author |
Message |
|
|
|
| Back to top |
|
 |
|
|
Posted: Jun 03, 2007 16:51 Post subject: |
|
|
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 |
|
 |
|
|
Posted: Jun 03, 2007 18:05 Post subject: |
|
|
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 |
|
 |
|
|
Posted: Jun 04, 2007 1:05 Post subject: |
|
|
| 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 |
|
 |
|
|
Posted: Jun 04, 2007 1:19 Post subject: |
|
|
link removed
Last edited by D.J.Peters on Jun 04, 2007 20:26; edited 1 time in total |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 04, 2007 20:25 Post subject: |
|
|
| Got it DJ -- thanks. You can remove it now. |
| |
|
| Back to top |
|
 |
|
|
Posted: Jun 05, 2007 3:11 Post subject: |
|
|
| {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 |
|
 |
|
|
Posted: Jun 05, 2007 6:57 Post subject: |
|
|
| Yeah, it's a zip file not a .tar.gz... |
| |
|
| Back to top |
|
 |
|
|
Posted: Jul 08, 2007 19:14 Post subject: |
|
|
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 |
|
 |
|
|
Posted: Jul 08, 2007 22:31 Post subject: |
|
|
| 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 |
|
 |
|
|
Posted: Jul 11, 2007 14:04 Post subject: |
|
|
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 |
|
 |
|
|
Posted: Jul 11, 2007 14:20 Post subject: |
|
|
| Thanks, cha0s! This clears some things up for me :D |
| |
|
| Back to top |
|
 |
|
|
Posted: Jul 23, 2007 20:19 Post subject: |
|
|
| oh... well ill give it another go. |
| |
|
| Back to top |
|
 |
|
|
Posted: Sep 15, 2007 22:34 Post subject: |
|
|
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 |
|
 |
|
|
Posted: Sep 16, 2007 2:18 Post subject: |
|
|
| Should be chr( getbuffer(0) ), also, it's chr(13, 10). |
| |
|
| Back to top |
|
 |
|
|
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
|
|