The code should return the name of a local SciSocketAddress. Lets say, that a method <A> is calling a
method <B>. The method <B> contains the following code:
- Code: Select all
"this is wrong code - but see remark at end of posting"
self == Processor sstCurrentActor ifTrue: [^self sstActorSend].
[
result := (temp1 := SciSocketAddress fromString: '192.168.56.1') isSciError
ifTrue: [ '?' ]
ifFalse:[
(temp2 := SciSocketManager default getHostBySockName: temp1) isSciError
ifTrue:[ temp2 ]
ifFalse:[ temp2 name ]
]
when: ExAll
do: [ :sig | sig exitWith: nil ].
result inspect.
This code is called from a background user process and the execution ends up in a
uint8At: due to general protection fault (when not adding an exception handler like the one above).
The exception is thrown in getHostBySockName:
- Code: Select all
getHostBySockName: aSocketAddress
"Answer an instance of a SciHostEnt. Extract the address from
the aSocketAddress and retrieve the host ent structure.
aSocketAddress
An instance of SciSocketAddress with a valid address, port and
family."
| byteArray hostent hostdata result |
hostent := OSHostEnt new.
hostdata := OSPtr calloc: OSHostData fixedSize.
byteArray := aSocketAddress socketAddrStruct byteArrayFromAddressNtoh32.
self dispatcher execute: [ |pointer |
result := (pointer := self dispatcher
callGetHostByAddrWith: byteArray
with: 4
with: AFINET
with: hostent
with: hostdata) isSciError
ifTrue: [pointer]
ifFalse: [SciHostEnt from: pointer].
hostdata free].
^result
where pointer always(!) points to address 114 (??????), which of course is a protected address ..... and "SciHostEnt from: " then throws the exception ...
The strange thing is, that I end up in the debugger and when I execute the first code ("SciSocketManager default getHostBySockName: temp1")
within the debugger I get the computer name (always) without any problems ....
I tried to include delays, but the problems remains ...
PS. 3:
I know, that the guarding command is wrong, but if I change it to
- Code: Select all
self ~~ Processor sstCurrentActor ifTrue: [^self sstActorSend].
....
the method does NOT throw an exception, BUT returns an instance of SstExplicitFuture to the method <A>, which of course leads to an does not understand error in the calling method <A>. The debugger opens at once and shows this error - and much, much later - an inspector comes up, with the resolved name (!!!).
Is there an error, or do have missing knowledge about SstActor programming .....