mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2003
Posts: 32
Q
quizer Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: May 2003
Posts: 32
open a socket 2 cnn.com 80 and b4 u w8 4 the socket 2 open- try 2 sockwrite something on this socket.
my mIRC crushed every time I did it...
it means that I should check if the socket have an 'active' status property b4 writing something 2 it. or just waiting 2 'on sockopen' event 2 trigger- it would b much easier if a buffer was saved 4 a connecting sockets.
I think that auto buffer is the only solutions- u can't save 2 file or 2 a hashtable- couz when u read it from there and try 2 sockwrite it- it says that line 2 long. if u split the lines- then u send actually 2 TCP packets when u wanted 1 packet.

Last edited by quizer; 24/05/03 08:25 PM.
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Could you have used any more acronyms/shorthand in that paragraph? jeeze..

Anyways, why should mirc have to queque a sockwrite for a socket thats not open yet. You should atleats have the common sense to wait for a socket to open before you send data to it. Your not going to pick up the phone, dial a friends house, and say "hello" before the other person picks up, are you? -- Thats why the sock open is there--use it.


-KingTomato
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
I tried the following alias, and experienced no crashes.

alias socktest {
sockopen test cnn.com 80
sockwrite test hello
}

Joined: Mar 2003
Posts: 272
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Mar 2003
Posts: 272
Same here, and i've had 50 sockets connecting at the same time and still no crashes.


- cF
Dedicated helper for rent.
Joined: May 2003
Posts: 177
P
Vogon poet
Offline
Vogon poet
P
Joined: May 2003
Posts: 177
quizer: Probably something to do with winsock.dll?

c0ldfusi0n: When you used the example script, did it print the following when you tried the command:

-
* /sockwrite: 'test' not connected (line 3, script2.mrc)
-

Joined: Mar 2003
Posts: 272
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Mar 2003
Posts: 272
Yeah, it does return that.
Here's the code i used after i realized he didn't want to wait for the sockopen event to trigger:
Code:
alias test0r {
  if ($1 == off) { .sockclose test.* }
  else {
    var %test0r = 50
    while (%test0r) { .sockopen test. [ $+ [ %test0r ] ] cnn.com 80 | sockwrite test. [ $+ [ %test0r ] ] Hello! | dec %test0r }
  }
}


- cF
Dedicated helper for rent.
Joined: May 2003
Posts: 32
Q
quizer Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: May 2003
Posts: 32
Code:
 
on *:sockread:Lobec:{
  sockread %Lobec
  if ($sock(robec).status != active) {
    hadd -m Robec $calc($hget(Robec,0).item +1) %lobec
    echo @state Client (saved): %Lobec
    return
  }
  echo @state Client: %Lobec
  sockwrite -tn Robec %Lobec
}
 


I exprienced a crash each time b4 I've added the
Code:
  if ($sock(robec).status != active) 

my winsock.dll (or wsock32.dll) is working 4 all other functions and it is the original file provided by winXP-pro (OS).
the queue I've created is a very limited solution.
even when u add &binVars 2 the hash table it is still limited couz when u try 2
Code:
  sockwrite robec $hget(HashT,1)  

and the $hget returns a &binVar so mIRC tells that line 2 long.
the only solution 4 that is 2 split the &binVar but it is still limited couz u have 2 send then few packets when it can fit in 1.
I've already splitted the &binVar but couz its a limited solution I've suggested that mIRC will save a queue 4 a socket b4 it opened.


Link Copied to Clipboard