Socket problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Socket problem

Andrés Garagiola
I'm making an server/client connection with VW and when i send #close or #shutdown: 2 messages over the server socket then VW image is  freezed until  i disconnect the client and so VW raise an exception "BADADR error" .  Do you know any solution for this problem?


Thanks
Andrés<span onclick="dr4sdgryt2(event)" style="cursor: pointer;"> <span onclick="dr4sdgryt2(event)" style="cursor: pointer;">
Reply | Threaded
Open this post in threaded view
|

Re: Socket problem

Reinout Heeck-2
Andrés Garagiola wrote:
> I'm making an server/client connection with VW and when i send #close
> or #shutdown: 2 messages over the server socket then VW image is  
> freezed until  i disconnect the client and so VW raise an exception
> "BADADR error" .  Do you know any solution for this problem?

That is weird.
#close may take time since it needs to flush any outstanding data over
the network and then finish with a handshake sequence.

#shutdown: 2 on the other hand should return immediately.

I don't know about the 'BADADR error', could you post a copy of the
stack so we can say more?
Also of interest would be which OS you are running on.

Do you have any successful communication happening before you issue the
#close? If not I'd hazard the guess that your network is malconfigured.


Reinout
-------

Reply | Threaded
Open this post in threaded view
|

Re: Socket problem

Reinout Heeck-2

Let me start with a remark: for normal closing of sockets stick with
#close, use #shutdown: only when you really know what you are doing, it
is more of an emergency break.


So you are getting a BADARGS error when using #shutdown:.
Assuming that you did not blunder on the 2 you supply as an argument to
the message it must be the only argument left that is bad: the receiver.

So I guess that you are trying to close an already closed socket.

I tried the following:

s := SocketAccessor newTCPclientToHost:'www.soops.nl' port: 80.
s close.
s close.

That works fine, closing an already closed socket throws no exception.

However:

s := SocketAccessor newTCPclientToHost:'www.soops.nl' port: 80.
s close.
s shutdown: 2.

will raise a BADARGS exception like you see in your framework.




Cheers,

Reinout
-------



Andrés Garagiola wrote:

> Sorry the exception was BADARGS_ERROR
> The OS is Windows XP.
>
> It's the stack
>
> Thancks
> Andres
>
> Unhandled exception: BADARGS_ERROR
> SocketAccessor class(OSErrorHolder class)>>reportOn:
> SocketAccessor(OSErrorHolder)>>reportError
> SocketAccessor>>shutdown:
> MyFramework.SenderConnectionProcess(MyFramework.ConnectionProcess)>>releaseResources
> MyFramework.CommunicationManager>>releaseResources
> MyFramework.Session>>closeSession
> PocketServer.MedicionController>>processLoggin:
> optimized [] in PocketServer.MedicionController>>buildMessageHandler
> MyFramework.MyMessageHandler>>processMessage:
> optimized [] in MyFramework.MyApplicationController >>processMessage:
> OrderedCollection>>do:
> PocketServer.MedicionController(MyFramework.MyApplicationController)>>processMessage:
> MyFramework.MySessionContext>>processMessage:
> PocketServer.MyPocketServer
> (MyFramework.MyApplication)>>processReceiveMessage:onSession:
> optimized [] in MyFramework.MyApplication>>processingMessageBlock
> MyFramework.Session>>receiveMessage
> optimized [] in MyFramework.Session >>initialize
> BlockClosure>>on:do:
> optimized [] in Process class>>forBlock:priority:
>
> ----------------------------------------------------------------------
> SocketAccessor class(OSErrorHolder class)>>reportOn:
> Receiver:
>     a SocketAccessor class
> Instance Variables:
>     superclass = BlockableIOAccessor
>     methodDict = a MethodDictionary[43]
>     format = 16386
>     subclasses = an Array[5]
>     instanceVariables = nil
>     organization = ('instance creation' #accept #acceptNonBlock)
> ('accessing' #bufferSize #getName #getOptionsLevel:name: #getPeer
> #getPendingError #setOptionsLevel:name:value:)
> ('constants' #connectPauseInterval #lineEndConvention)
> ('testing' #atMark)
> ('specialized IO' #receiveFrom:buffer: #receiveFrom:buffer:start:for:
> #receiveFrom:buffer:start:for:flags: #sendTo:buffer:
> #sendTo:buffer:start:for: #sendTo:buffer:start:for:flags: #shutdown:)
> ('state transitions' #bindTo: #connectTo: #connectTo:timeout: #listenFor:)
> ('private' #handleAsyncConnect:timeout: #primAccept #primClose
> #primConnectTo: #primGetName #primGetPeer
> #primNofailReadInto:startingAt:for:
> #primNofailWriteFrom:startingAt:for: #primReadInto:startingAt:for:
> #primReceiveFrom:buffer:start:for:flags:
> #primWriteFrom:startingAt:for: #privateReadInto:startingAt:for:
> #privateWriteFrom:startingAt:for: #setSem:forWrite:)
> ('options' #soBroadcast: #soReuseaddr: #tcpNoDelay:)
> ('multicasting' #drop: #join: #mLoop: #ttl:)
>
>     name = #SocketAccessor
>     classPool = a NameSpaceOfClass[0]
>     environment = a NameSpace[103]
>     concreteClass = WinSocketAccessor
> Arguments:
>     anErrorHolder = an inactive SocketAccessor(Error: BADARGS_ERROR)
> Temporaries:
>     errorSignal = OSErrorHolder badArgumentsSignal
> Context PC = 31
>
> ----------------------------------------------------------------------
> SocketAccessor(OSErrorHolder)>>reportError
> Receiver:
>     a SocketAccessor
> Instance Variables:
>     errorCode = -5
>     handle = nil
> Context PC = 6
>
> ----------------------------------------------------------------------
> SocketAccessor>>shutdown:
> Receiver:
>     a SocketAccessor
> Instance Variables:
>     errorCode = -5
>     handle = nil
> Arguments:
>     num = 2
> Context PC = 8
>
> ----------------------------------------------------------------------
> MyFramework.SenderConnectionProcess(MyFramework.ConnectionProcess)>>releaseResources
> Receiver:
>     a MyFramework.SenderConnectionProcess
> Instance Variables:
>     connectionSocket = an inactive SocketAccessor(Error: BADARGS_ERROR)
>     socketStream = an ExternalReadAppendStream
>     isActive = true
>     messageQueue = a SharedQueue
>     runProcess = a Process in nil
> Context PC = 6
>
> ----------------------------------------------------------------------
> MyFramework.CommunicationManager>>releaseResources
> Receiver:
>     a MyFramework.CommunicationManager
> Instance Variables:
>     receiverProcess = a MyFramework.ReceiverConnectionProcess
>     senderProcess = a MyFramework.SenderConnectionProcess
>     timeOut = nil
> Context PC = 17
>
> ----------------------------------------------------------------------
> MyFramework.Session>>closeSession
> Receiver:
>     a MyFramework.Session
> Instance Variables:
>     communicationManager = a MyFramework.CommunicationManager
>     startTimestamp = August 16, 2007 20:23:05.580
>     validateEcho = true
>     receiveProcess = a Process in Process>>resume
>     processingMessageBlock = BlockClosure [] in
> MyFramework.MyApplication>>processingMessageBlock
>     glorpSession = a Glorp.GlorpSession
>     sessionVariables = nil
> Context PC = 5
>
> ----------------------------------------------------------------------
> PocketServer.MedicionController>>processLoggin:
> Receiver:
>     a PocketServer.MedicionController
> Instance Variables:
>     model = nil
>     messageHandlers = an OrderedCollection[2]
> Arguments:
>     aCommunicationMessage = a MyFramework.CommunicationRequest
> Temporaries:
>     usuario = nil
>     s = a MyFramework.Session
> Context PC = 29
>
> ----------------------------------------------------------------------
> optimized [] in PocketServer.MedicionController >>buildMessageHandler
> Receiver:
>     an UndefinedObject
> Arguments:
>     eachMessage = a MyFramework.CommunicationRequest
> Temporaries:
>     .self = a PocketServer.MedicionController
> Context PC = 7
>
> ----------------------------------------------------------------------
> MyFramework.MyMessageHandler>>processMessage:
> Receiver:
>     a MyFramework.MyMessageHandler
> Instance Variables:
>     conditionBlock = BlockClosure [] in
> MyFramework.MyApplicationController>>whenMessageType:do:
>     processBlock = BlockClosure [] in
> PocketServer.MedicionController>>buildMessageHandler
> Arguments:
>     t1 = a MyFramework.CommunicationRequest
> Context PC = 6
>
> ----------------------------------------------------------------------
> optimized [] in MyFramework.MyApplicationController>>processMessage:
> Receiver:
>     an UndefinedObject
> Arguments:
>     eachHandler = a MyFramework.MyMessageHandler
> Temporaries:
>     .aCommunicationMessage = a MyFramework.CommunicationRequest
> Context PC = 6
>
> ----------------------------------------------------------------------
> OrderedCollection>>do:
> Receiver:
>     an OrderedCollection
> Instance Variables:
>     firstIndex = 1
>     lastIndex = 1
> Arguments:
>     aBlock = BlockClosure [] in MyFramework.MyApplicationController
> >>processMessage:
> Temporaries:
>     index = 1
> Context PC = 17
>
> ----------------------------------------------------------------------
> PocketServer.MedicionController(MyFramework.MyApplicationController
> )>>processMessage:
> Receiver:
>     a PocketServer.MedicionController
> Instance Variables:
>     model = nil
>     messageHandlers = an OrderedCollection[2]
> Arguments:
>     aCommunicationMessage = a MyFramework.CommunicationRequest
> Temporaries:
>     handlers = an OrderedCollection[1]
> Context PC = 13
>
> ----------------------------------------------------------------------
> MyFramework.MySessionContext>>processMessage:
> Receiver:
>     a MyFramework.MySessionContext
> Instance Variables:
>     session = a MyFramework.Session
>     controllerStack = a MyFramework.MyStack
>     timestamp = August 16, 2007 20:23:09.252
> Arguments:
>     t1 = a MyFramework.CommunicationRequest
> Temporaries:
>     t2 = nil
> Context PC = 6
>
> ----------------------------------------------------------------------
> PocketServer.MyPocketServer(MyFramework.MyApplication)>>processReceiveMessage:onSession:
>
> Receiver:
>     a PocketServer.MyPocketServer
> Instance Variables:
>     communicationServer = a MyFramework.CommunicationServer
> Arguments:
>     t1 = a MyFramework.CommunicationRequest
>     t2 = a MyFramework.Session
> Temporaries:
>     t3 = a MyFramework.MySessionContext
> Context PC = 23
>
> ----------------------------------------------------------------------
> optimized [] in MyFramework.MyApplication>>processingMessageBlock
> Receiver:
>     an UndefinedObject
> Arguments:
>     t1 = a MyFramework.Session
> Temporaries:
>     t2 = a MyFramework.CommunicationRequest
>     .self = a PocketServer.MyPocketServer
> Context PC = 13
>
> ----------------------------------------------------------------------
> MyFramework.Session>>receiveMessage
> Receiver:
>     a MyFramework.Session
> Instance Variables:
>     communicationManager = a MyFramework.CommunicationManager
>     startTimestamp = August 16, 2007 20:23:05.580
>     validateEcho = true
>     receiveProcess = a Process in Process>>resume
>     processingMessageBlock = BlockClosure [] in
> MyFramework.MyApplication>>processingMessageBlock
>     glorpSession = a Glorp.GlorpSession
>     sessionVariables = nil
> Context PC = 9
>
> ----------------------------------------------------------------------
> optimized [] in MyFramework.Session>>initialize
> Receiver:
>     an UndefinedObject
> Temporaries:
>     .self = a MyFramework.Session
> Context PC = 6
>
> ----------------------------------------------------------------------
> BlockClosure>>on:do:
> Receiver:
>     a BlockClosure
> Instance Variables:
>     method = CompiledBlock [] in MyFramework.Session>>initialize
>     outerContext = nil
>     copiedValues = a MyFramework.Session
> Arguments:
>     anExceptionSelector = TerminateException
>     handlerBlock = BlockClosure [] in [] in Process
> class>>forBlock:priority:
> Context PC = 18
>
> ----------------------------------------------------------------------
> optimized [] in Process class>>forBlock:priority:
> Receiver:
>     an UndefinedObject
> Temporaries:
>     .aBlock = BlockClosure [] in MyFramework.Session>>initialize
> Context PC = 9
>
>
> 2007/8/16, Reinout Heeck < [hidden email] <mailto:[hidden email]>>:
>
>     Andrés Garagiola wrote:
>     > I'm making an server/client connection with VW and when i send
>     #close
>     > or #shutdown: 2 messages over the server socket then VW image is
>     > freezed until  i disconnect the client and so VW raise an exception
>     > "BADADR error" .  Do you know any solution for this problem?
>
>     That is weird.
>     #close may take time since it needs to flush any outstanding data over
>     the network and then finish with a handshake sequence.
>
>     #shutdown: 2 on the other hand should return immediately.
>
>     I don't know about the 'BADADR error', could you post a copy of the
>     stack so we can say more?
>     Also of interest would be which OS you are running on.
>
>     Do you have any successful communication happening before you
>     issue the
>     #close? If not I'd hazard the guess that your network is
>     malconfigured.
>
>
>     Reinout
>     -------
>
>