Comments on: About the Access Error: Port none not open
There is an annoying error message that can occur from time to time:
** Access Error: Port none not open
It happens when your code tries to transfer data to or from a port that is not open.
Here is an example that shows it happening:
>> close a: open tcp://www.rebol.com:80 >> copy a ** Access Error: Port none not open
Unfortunately, the error message is confusing and does not help you debug the problem. In the case above, the problem is obvious, but in many cases, you don't know what port got into trouble.
The "none" part of the error message comes from the port's target field. If there is no target, you see the "none".
If you're having this problem, one way to debug it is to fill in a target name yourself when you open the port. Here's an example:
>> a: open tcp://www.rebol.com:80 >> a/target: a/host >> close a >> copy a ** Access Error: Port www.rebol.com not open
Of course, watch out for any code that might access the target field and incorrectly find your contents.
Also, we are experimenting with a change in the next release that builds a better error message:
>> close a: open tcp://www.rebol.com:80 >> copy a ** Access Error: port tcp://www.rebol.com:80 not open
This change would be included in the 2.7.7 release.
Post a Comment:
You can post a comment here. Keep it on-topic.