Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

MathLink supports two communication protocols on all platforms: TCPIP or shared memory. There are additional protocols supported on some systems only ("FileMap" and "Pipes" according to the docs).

I do not have much familiarity with MathLink's C language interface.

Question: Is the MathLink communication protocol user-customizable? Can MathLink be extended by users to use an alternative underlying communication protocol (example)?

share|improve this question
    
I expect the answer to be "no", but it happened before that I asked such a question and I received a surprisingly positive answer. –  Szabolcs Jan 24 '12 at 14:18
    
Seems like you could write a MathLink wrapper that tunneled over any kind of connection you like. Does that fit the parameters of your intent? –  sblom Jan 24 '12 at 16:07
    
@sblom, that is a good point. I would assume it would. –  rcollyer Jan 24 '12 at 16:13
    
The protocols are implemented in the .mlp files which are called from the main MathLink libraries (ml64i3 etc.), so in principle the answer is yes. However, the API and ABI by means of which these two MathLink components communicate is totally undocumented, so writing a new .mlp file is likely to be pretty much impossible without reverse-engineering both parts. Debug versions with symbols are included in the MathLink Developer Kit if you're feeling adventurous... –  Oleksandr R. Jan 31 '12 at 22:12
add comment

1 Answer

Seems entirely possible. I'd start by writing a stub for each end whose entire purpose is to echo MathLink traffic over your custom channel. Without doing any measurement, my first guess would be that you should use the existing shared memory protocol for the stub to connect to the MathLink peer on either end.

As I think about it more, the stubs don't really even need to understand the MathLink protocol at all. If you use TCP/IP on either end, and you have a way to tunnel TCP/IP over your custom channel (a la SSH port forwarding), you're all set and don't have to write any code.

share|improve this answer
    
+1, for pointing out how to not write any code at all. –  rcollyer Jan 24 '12 at 17:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.