mIRC Home    About    Download    Register    News    Help

Print Thread
mIRC Sockets + Telnet #172851 17/03/07 05:58 AM
Joined: Aug 2006
Posts: 10
S
Surfer666 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2006
Posts: 10
I am using Sockets to connect to the console of Starsiege Tribes, my idea is to get the output of the console and then relay it into IRC. It has worked so far, but I have been noticing that there is a slight issue with some of the recieved data not being parsed.

Basically there are multiple servers and the basic idea would be to interconnect them using mIRC.

I have been able to connect to the appropriate servers (local network, so not a network issue)

Code:
on *:sockread:Socket:{
  var %i
  sockread %i
  tokenize 32 %i

   var %name, %message
   %name = $2
   %message = $4-

   aline -p @Socket %i

   msg #channel $+(%name,:) %message
   sockwrite -n OtherSocket Input(%message);
  }
}


The problem is that sometimes there is a lot of stuff being sent through Telnet and it seems to print to the @Socket window fine, but it does not proceed further (thats the simplified code there...)

I was wondering if anyone knows of how to make it so that it evaluates the data...

Re: mIRC Sockets + Telnet [Re: Surfer666] #172872 17/03/07 02:07 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
First off, this should've been posted in the Scripts & Popups forum, not Developer Forum.

Secondly, you have an extra closed brace in your code, which (from mIRC 6.2) will cause your code to not work.

Finally, here's a re-write of your code that should work just fine based on what you supplied for the original code.

Code:
on *:sockread:Socket:{
  var %i
  sockread %i
  tokenize 32 %i
  aline -p @Socket %i
  msg #channel $+($2,:) $4-
  sockwrite -n OtherSocket Input(%message);
}

Re: mIRC Sockets + Telnet [Re: Surfer666] #172883 17/03/07 05:03 PM
Joined: Aug 2006
Posts: 10
S
Surfer666 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2006
Posts: 10
Well if anyone would kindly move my topic, that would be great.

The extra bracket there was due to an if statement which was there...

Also there are variables there because the actual code is more complicated, dealing with parsing the message and what not.

Re: mIRC Sockets + Telnet [Re: Surfer666] #172884 17/03/07 05:12 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Without knowing what the missing parts of the code do, and how the server sends/receives data, the code you have there will read the incoming data from the socket, and message whatever $2 and $4- contain to the channel.

I noticed that this line won't do what I suspect you are trying to do:

sockwrite -n OtherSocket Input(%message);

It will write the following LITERAL text to OtherSocket:

Input(%message);

Since the variable is directly beside the brackets it will not be filled with the contents of %message. Try this instead:

sockwrite -n OtherSocket Input( $+ %message $+ )

If there are other problems, you will have to describe them better, and provide the actual code that is having the problems.

-genius_at_work


Re: mIRC Sockets + Telnet [Re: genius_at_work] #172886 17/03/07 05:16 PM
Joined: Aug 2006
Posts: 10
S
Surfer666 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2006
Posts: 10
The data received is just what ever is being displayed at the console, and is transmitted to the Socket via Telnet, which the socket logs into and listens to...

The data part, and data handling isn't the problem... The problem is that sometimes mIRC will see data (as in it will aline to the right window) but not message it to #channel or the other socket.

I was wondering if anyone already knew some limitation or perhaps some sort of way to fix this issue.

Thanks for all the help.

Re: mIRC Sockets + Telnet [Re: Surfer666] #172888 17/03/07 05:28 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
As I mentioned, the code you have shown above will ALWAYS (try to) message something to the channel. The way it is written, even if %name and %message are null, it will simply message a lone : to the channel (because of the $+(%name,:) part).

So, this isn't a 'known issue' because the /aline and /msg commands are known to work fine. The only things I can think of are that the parts you have removed from your above code are causing problems, or the channel is somehow blocking your messages. Try enabling debug mode on mIRC so you can see the messages that are sent to the server even if they are blocked from the channel by the server.

-genius_at_work

Re: mIRC Sockets + Telnet [Re: Surfer666] #172891 17/03/07 05:42 PM
Joined: Aug 2006
Posts: 10
S
Surfer666 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2006
Posts: 10
Hmm... it seems it only gets to be a problem when there are more than 10 people or so on the servers... then there's a lot of data being output into the console, which has to get through telnet then parsed...

Maybe there's a limit to how much data mIRC can handle from a socket? (like speed wise... each message is less than 255 characters really)

(Also to note blank messages aren't a problem, there's a check in place for that... and mostly it only sends stuff where $1 == >>> something I added in the console to easily recognize it by mIRC)

Re: mIRC Sockets + Telnet [Re: Surfer666] #172903 17/03/07 07:53 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If there is a limit (and I guess technically there might be), it's definetely higher than 255 characters, as I use sockets in a script that Genius helped me with, and at times the socket reads in nearly 4000 characters. A lot more than the 255 mark

Re: mIRC Sockets + Telnet [Re: Surfer666] #172905 17/03/07 08:17 PM
Joined: Aug 2006
Posts: 10
S
Surfer666 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2006
Posts: 10
I was saying that maybe mIRC couldn't process the 20+ messages per second that is sent through Telnet

Re: mIRC Sockets + Telnet [Re: Surfer666] #172906 17/03/07 08:36 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
mIRC can handle the data coming from the sockets with no problem. However, if you are trying to send ALL that data to the IRC server (#channel) at the same speed that it comes off the server, you will likely get throttled by mIRC's built-in message throttle, or the additional messages may be denied by the IRC server. If you are receiving 20+ messages per second from the socket, that will likely be considered a 'flood' to the IRC server. Again, I would suggest using the /debug @debug command so you can see if the messages are being sent to the server, regardless of whether the server displays them in the channel or not.

If this is the case, you could modify the code to write the socket data to a temp text file until all the data has been received, and then /play the file to the channel.

-genius_at_work

Re: mIRC Sockets + Telnet [Re: genius_at_work] #172916 17/03/07 11:16 PM
Joined: Aug 2006
Posts: 10
S
Surfer666 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Aug 2006
Posts: 10
Oh no... it's not the sending to the IRC channel that's the problem...

It's that the data that gets received by mIRC does nothing at all... like it doesn't even get sent to the other socket (which basically sends it into the other server...)

Re: mIRC Sockets + Telnet [Re: Surfer666] #172925 18/03/07 05:12 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Well, the story seems to keep changing.

As far as everyone knows, the commands you are using work without any problems. That means that the problem lies in your coding. Since you haven't posted your complete code, no one here will be able to help you with any accuracy. I (and others) could guess until we are blue in the face and still never solve the problem.

-genius_at_work

Re: mIRC Sockets + Telnet [Re: Surfer666] #174761 12/04/07 01:51 PM
Joined: Dec 2002
Posts: 580
N
NaquadaServ Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 580
genius is right about, linking channels on different servers isn't a good idea because of server flood protection. Have you considered linking all DCC chat sessions for a particular client, that way the users would only need to DCC chat with a common bot and everyone on multiple servers could talk to each other. Then you don't need sockets either... smile

Using this arrangment, a client script that doesn't display the bot's name in the DCC chat window, would also be a nice touch, but it wouldn't be needed.

Last edited by NaquadaServ; 12/04/07 01:53 PM.

NaquadaBomb
www.mirc-dll.com