Socket accept()

Frank Gerlach frankgerlach22 at gmx.de
Sun Dec 26 21:39:17 UTC 2004


Hello Folks,
after using client sockets, I now try server sockets.
The following coce just throws "A primitive has failed" when
I try to connect via telnet. Can you help me or point me to a
code snippet of a server (I looked at KomHttpServer but couldn't 
identify the accept()ing :-( )


|socket client|
Socket initializeNetwork.
socket:=(Socket newTCP).
socket listenOn:1333.

[true] whileTrue:[
	client:=socket waitForAcceptFor:10000.	
]

This is the stackTrace:

Error: a primitive has failed
26 December 2004 10:36:24 pm

VM: Win32 - a SmalltalkImage
Image: Squeak3.7 [latest update: #5989]

SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir c:\franksordner\dev\squeak
Trusted Dir c:\franksordner\dev\squeak\Frank
Untrusted Dir C:\My Squeak\Frank

Socket(Object)>>error:
	Receiver: a Socket[destroyed]
	Arguments and temporary variables: 
		aString: 	'a primitive has failed'
	Receiver's instance variables: 
		semaphore: 	a Semaphore()
		socketHandle: 	nil
		readSemaphore: 	a Semaphore()
		writeSemaphore: 	a Semaphore()
		primitiveOnlySupportsOneSemaphore: 	true

Socket(Object)>>primitiveFailed
	Receiver: a Socket[destroyed]
	Arguments and temporary variables: 

	Receiver's instance variables: 
		semaphore: 	a Semaphore()
		socketHandle: 	nil
		readSemaphore: 	a Semaphore()
		writeSemaphore: 	a Semaphore()
		primitiveOnlySupportsOneSemaphore: 	true

Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:
	Receiver: a Socket[destroyed]
	Arguments and temporary variables: 
		aHandle: 	a ByteArray(180 95 86 2 0 0 0 0 240 205 8 0)
		rcvBufSize: 	8000
		sndBufSize: 	8000
		semaIndex: 	9
	Receiver's instance variables: 
		semaphore: 	a Semaphore()
		socketHandle: 	nil
		readSemaphore: 	a Semaphore()
		writeSemaphore: 	a Semaphore()
		primitiveOnlySupportsOneSemaphore:
	true

Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:readSemaIndex:writeSemaIndex:
	Receiver: a Socket[destroyed]
	Arguments and temporary variables: 
		aHandle: 	a ByteArray(180 95 86 2 0 0 0 0 240 205 8 0)
		rcvBufSize: 	8000
		sndBufSize: 	8000
		semaIndex: 	9
		aReadSema: 	10
		aWriteSema: 	11
	Receiver's instance variables: 
		semaphore: 	a Semaphore()
		socketHandle: 	nil
		readSemaphore: 	a Semaphore()
		writeSemaphore: 	a Semaphore()
		primitiveOnlySupportsOneSemaphore: 	true


--- The full stack
---
Socket(Object)>>error:
Socket(Object)>>primitiveFailed
Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:
Socket>>primAcceptFrom:receiveBufferSize:sendBufSize:semaIndex:readSemaIndex:writeSemaIndex:
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Socket>>acceptFrom:
[] in Socket class>>acceptFrom: {[super new acceptFrom: aSocket]}
BlockContext>>repeatWithGCIf:
Socket class>>acceptFrom:
Socket>>accept
Socket>>waitForAcceptFor:
UndefinedObject>>DoIt
Compiler>>evaluate:in:to:notifying:ifFail:logged:
[] in TextMorphEditor(ParagraphEditor)>>evaluateSelection {[rcvr class
evaluatorClass new   evaluate: self selectionAsStream   in: ctxt...]}
BlockContext>>on:do:
TextMorphEditor(ParagraphEditor)>>evaluateSelection
[] in PluggableTextMorph>>doIt {[textMorph editor evaluateSelection]}
[] in PluggableTextMorph>>handleEdit: {[result := editBlock value]}
TextMorphForEditView(TextMorph)>>handleEdit:
PluggableTextMorph>>handleEdit:
PluggableTextMorph>>doIt
Workspace(StringHolder)>>perform:orSendTo:
[] in MenuItemMorph>>invokeWithEvent: {[(selArgCount := selector numArgs) =
0   ifTrue: [target perform: selector] ...]}
BlockContext>>ensure:
CursorWithMask(Cursor)>>showWhile:
MenuItemMorph>>invokeWithEvent:
MenuItemMorph>>mouseUp:
MenuItemMorph>>handleMouseUp:
MouseButtonEvent>>sentTo:
MenuItemMorph(Morph)>>handleEvent:
MorphicEventDispatcher>>dispatchDefault:with:
MorphicEventDispatcher>>dispatchEvent:with:
MenuItemMorph(Morph)>>processEvent:using:
MorphicEventDispatcher>>dispatchDefault:with:
MorphicEventDispatcher>>dispatchEvent:with:
MenuMorph(Morph)>>processEvent:using:
MenuMorph(Morph)>>processEvent:
MenuMorph>>handleFocusEvent:
[] in HandMorph>>sendFocusEvent:to:clear: {[ActiveHand := self.  ActiveEvent
:= anEvent.  result := focusHolder     han...]}
[] in PasteUpMorph>>becomeActiveDuring: {[aBlock value]}
BlockContext>>on:do:
PasteUpMorph>>becomeActiveDuring:
HandMorph>>sendFocusEvent:to:clear:
HandMorph>>sendEvent:focus:clear:
HandMorph>>sendMouseEvent:
HandMorph>>handleEvent:
HandMorph>>processEvents
[] in WorldState>>doOneCycleNowFor: {[:h |  ActiveHand := h.  h
processEvents.  capturingGesture := capturingGest...]}
Array(SequenceableCollection)>>do:
WorldState>>handsDo:
WorldState>>doOneCycleNowFor:
WorldState>>doOneCycleFor:
WorldState>>doOneSubCycleFor:
PasteUpMorph>>doOneSubCycle
MenuMorph>>invokeModalAt:in:allowKeyboard:
MenuMorph>>invokeModal:
MenuMorph>>invokeModal
...etc...

-- 
+++ Sparen Sie mit GMX DSL +++ http://www.gmx.net/de/go/dsl
AKTION für Wechsler: DSL-Tarife ab 3,99 EUR/Monat + Startguthaben



More information about the Squeak-dev mailing list