Call this to invoke .NET/Link's internal handling of special packet types.
[Visual Basic]Sub HandlePacket( _
ByVal
pktAs
PacketType_
)
ParametersIf you absolutely must write your own packet loop instead of using the PacketArrived event, (this is strongly discouraged), you should call this method if a call to NextPacket returns a packet type that you are not handling entirely with your own code. In fact, you can call HandlePacket for every packet you read with NextPacket.
For example, here is a basic packet loop:
bool done = false; while (!done) { PacketType pkt = ml.NextPacket(); if (ml.OnPacketArrived(pkt)) ml.HandlePacket(pkt); switch (pkt) { case PacketType.Return: // read and handle contents of ReturnPacket ... done = true; break; case PacketType.Text: // read and handle contents of TextPacket ... break; .. etc for other packet types } ml.NewPacket(); }
After HandlePacket returns you should call
NewPacket.
To remind again, writing your own packet loop like this is strongly discouraged. Use WaitForAnswer, WaitAndDiscardAnswer, or one of the "EvaluateTo" methods instead. These methods hide the packet loop within them. If you want more information about what packet types arrive and their contents, simply use the PacketArrived event.
An example of the special type of packets that your packet loop might encounter is PacketType.Call. Encountering a PacketType.Call means that
Mathematicacode is trying to call into .NET using the mechanism described in Part 1 of the .NET/Link User Guide. Only the internals of .NET/Link know how to manage these callbacks, so the HandlePacket method provides a means to invoke this handling for you.
If you are using WaitForAnswer, WaitAndDiscardAnswer, or any of the "EvaluateTo" methods, and therefore not writing your own packet loop, you do not need to be concerned with HandlePacket.
Exceptions See AlsoIKernelLink Interface | Wolfram.NETLink Namespace
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4