mIRC Home    About    Download    Register    News    Help

Topic Options
#261935 - 15/12/17 11:00 AM Get the active connection socket handle
goblin58 Offline
Nutrimatic drinks dispenser

Registered: 22/11/17
Posts: 9
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.

Top
#261937 - 15/12/17 11:46 AM Re: Get the active connection socket handle [Re: goblin58]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
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.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#261943 - 15/12/17 04:35 PM Re: Get the active connection socket handle [Re: Wims]
goblin58 Offline
Nutrimatic drinks dispenser

Registered: 22/11/17
Posts: 9
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.

Top
#261945 - 15/12/17 04:52 PM Re: Get the active connection socket handle [Re: goblin58]
FroggieDaFrog Offline
Hoopy frood

Registered: 16/04/10
Posts: 907
Loc: USA
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.


Edited by FroggieDaFrog (15/12/17 05:06 PM)
_________________________
I am SReject
My Stuff

Top
#261946 - 15/12/17 05:09 PM Re: Get the active connection socket handle [Re: goblin58]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3438
Loc: France
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.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#261948 - 15/12/17 09:22 PM Re: Get the active connection socket handle [Re: goblin58]
Sat Offline
Hoopy frood

Registered: 19/04/04
Posts: 831
Loc: The Netherlands
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

Top
#261950 - 15/12/17 10:16 PM Re: Get the active connection socket handle [Re: Sat]
goblin58 Offline
Nutrimatic drinks dispenser

Registered: 22/11/17
Posts: 9
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.

Top