mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2017
Posts: 19
G
Pikka bird
OP Offline
Pikka bird
G
Joined: Nov 2017
Posts: 19
Is there a way to get the active connection socket handle?

I would like to be able to send raw messages from my dll via sockets but use the existing connection rather than create a new one.

Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
You can use sendmessage() to communicate with mIRC and execute command from your to dll, that's your way to send raw messages, it wouldn't be safe to expose the real handle of sockets used in mIRC.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2017
Posts: 19
G
Pikka bird
OP Offline
Pikka bird
G
Joined: Nov 2017
Posts: 19
Thanks for the reply. I'm aware of SendMessage, why isn't it safe to expose the socket handle, after all it's just a stream, just like a pipe or file. The worst you could do is close it and force mIRC to re-connect. I guess you could send malformed data but you can do that just as easily with /raw.

I'm trying to avoid SendMessage, I don't really like using a file interface, just more overhead and resources to worry about.

Anyways, I guess the answer is simply no.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
mIRC has quite a bit of behind-the-scenes stuff going on with many of its "interfaces"; this includes sockets. There's state tracking variables and the like. For example the 16k write buffer. If you were to append data directly to the socket descripter chances are $sock().sq would not correctly align with whats actually in the buffer.

As far as SendMessage is concerned, you do realize the file descripter isn't an actual file, correct? There's no HDD read/writes; its an in-memory interface.

Why avoid SendMessage? Afterall, its one of Microsoft's recommended native methods for inter-program communications.

Last edited by FroggieDaFrog; 15/12/17 05:06 PM.

I am SReject
My Stuff
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
Quote:
The worst you could do is close it and force mIRC to re-connect
That's exactly why it's not exposed, if you were to close the handle it would not force mIRC to reconnect, it would most likely make mIRC crashes on the spot, or similar, because it would be using an invalid handle.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
In addition to the other answers: if you were to use the socket handle directly, then whatever you're going to do is not going to work with SSL connections.


Saturn, QuakeNet staff
Joined: Nov 2017
Posts: 19
G
Pikka bird
OP Offline
Pikka bird
G
Joined: Nov 2017
Posts: 19
Thanks for the answers everyone, I'll use the shared memory approach (even though its not IPC).

Shame there is no public interface available, it would make it all so much easier.


Link Copied to Clipboard