Entrar
¿Nuevo usuario? Inscribirme
squeakRos
? ¿Ya estás suscrito? Entra a Yahoo!

Consejos

¿Sabías que...?
Podés hacer búsquedas de antiguos mensajes del grupo.

Mensajes

  Mensajes Ayuda
Avanzado
[TEG] Primer experimento de protocolo de red   Lista de mensajes  
Responder | Reenviar Mensaje #476 de 3344 |
A todos los interesados, les cuento.
Esta mañana hicimos correr con Mauricio en la UTN el primer experimento para
el TEG en red.
Llevamos una imagen del SqueakLight cargada con el TEG y con los archvios
que adjunto.
Haciendo en la imagen que actua como server VNCServer start y en los
clientes RemoteClient new, pudimos ver que el "amillo' funcionó con los
siguientes errores.
Aparentemente el server contesta a todos los clientes, aunque si procesa el
"token" lógico de esperar comando de la máquina cliente que corresponde.
El supuesto es que con tantas pruebas y modificaciones , está faltando en el
RemoteExperiments.5.cs que el server mande a los clientes un 'WAIT' y que
estos continuen el lazo de espera hasta recibirlo, por eso adjunto el 4
también.
Voy a ver de solucionar esto el fin de semana, el lunes a las 9 conseguimos
que nos presten laboratorio para hacer una nueva prueba en red.
Como cosa extraña, aquí con una Mac corriendo OS X t la otra OS 9.1'Ed' ,
eso no ocurrió, por lo que intentare el lunes llevar a "Voyager" y ponerla
en red bajo Windos 2000 Server (que es lo que hay alLá).
La idea es cuando ande , mandar un objeto que tenga el "estado" del juego y
ver si se lo banca con sendObject y sendObject que oportunamente le copie a
Diego.
También agregaré a la lista de autores copiados a Colin Putney que hizo el
VNCServer (que uso y modifico para transformarlo en TEGServer).
Cuando tenga algo mas depurado, voy a ver de contactarlo ya que se que algo
de castellano entiende.

Edgar



Vie, 23 de Abr, 2004 6:27 pm

edgardec2001
Sin conexión Sin conexión
Enviar correo Enviar correo

'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 22 April 2004 at
10:09:58 am'! "Change Set: RemoteExperiments Date: 3 April 2004 Author: edc
This is a little toy for comand SqueakLight server from a regular image. Uses a
couple of methods by Diego Gomez Deck. lets send and receive objects and with
String complier in remote you can do nice tricks"! Object subclass:
#RemoteClient instanceVariableNames: 'socket serverName ' classVariableNames:
'' poolDictionaries: '' category: 'RemoteExperiments'! !RemoteClient
methodsFor: 'as yet unclassified' stamp: 'edc 4/22/2004 09:58'! initialize |
command | Transcript open. Transcript show: 'starting remote comm test';
cr. Transcript show: 'initializing network ... '. Socket initializeNetwork.
Transcript show: 'ok'; cr. serverName _ 'localhost'. command _ 'UNO'
asByteArray. Transcript show: 'server start to perform instructions'; cr.
self newSocket. self nextCommand: command! ! !RemoteClient methodsFor: 'as yet
unclassified' stamp: 'edc 4/20/2004 11:54'! newCommand ^ FillInTheBlank
request: 'Type remote image command' initialAnswer: ''. ! ! !RemoteClient
methodsFor: 'as yet unclassified' stamp: 'edc 4/22/2004 08:03'! newSocket
socket _ Socket newTCP. socket connectTo: (NetNameResolver addressForName:
serverName) port: 8000. socket waitForConnectionUntil: Socket
standardDeadline! ! !RemoteClient methodsFor: 'as yet unclassified' stamp: 'edc
4/22/2004 09:58'! nextCommand: aString | objRec command | command _ aString.
[command = 'FIN'] whileFalse: [ (socket isValid and: [socket
isConnected]) ifTrue: [Transcript show: 'Command sended is ' , command;
cr. socket sendData: command] ifFalse: ["stale connection" socket
destroy. socket _ nil]. [socket dataAvailable] whileFalse. objRec _
socket getData. Transcript show: 'Response is ' , objRec printString;
cr. objRec = 'WAIT' ifTrue: [[socket dataAvailable] whileFalse.
objRec _ socket getData. self halt]. command _ self newCommand]! !
!RemoteClient class methodsFor: 'as yet unclassified' stamp: 'edc 2/16/2004
09:53'! new super new initialize! ! !Socket methodsFor: 'receiving' stamp:
'edc 2/15/2004 09:17'! getData | t1 t2 | (self waitForDataUntil: Socket
standardDeadline) ifFalse: [self error: 'getData timeout']. t1 _ String new:
4000. t2 _ self primSocket: socketHandle receiveDataInto: t1
startingAt: 1 count: t1 size. ^ t1 copyFrom: 1 to: t2! ! !Socket
methodsFor: 'waiting' stamp: 'jm 3/2/98 18:15'! waitForConnectionUntil: deadline
"Wait up until the given deadline for a connection to be established. Return
true if it is established by the deadline, false if not." | status | status _
self primSocketConnectionStatus: socketHandle. [(status = WaitingForConnection)
and: [Time millisecondClockValue < deadline]] whileTrue: [ semaphore
waitTimeoutMSecs: (deadline - Time millisecondClockValue). status _ self
primSocketConnectionStatus: socketHandle]. ^ status = Connected! ! !Socket
methodsFor: 'waiting' stamp: 'edc 2/15/2004 09:19'! waitForDataUntil: deadline
"Wait up until the given deadline for data to arrive. Return true if data
arrives by the deadline, false if not." | dataArrived | [self isConnected &
(dataArrived := self primSocketReceiveDataAvailable: socketHandle) not and:
["Connection end and final data can happen fast, so test in this order "
Time millisecondClockValue < deadline]] whileTrue: [self readSemaphore
waitTimeoutMSecs: deadline - Time millisecondClockValue]. ^ dataArrived! !
!Socket methodsFor: 'sending-receiving objects' stamp: 'dgd 2/22/2002 20:28'!
getObject "gets a serialized object from this socket" | encoded object |
encoded _ String new writeStream. [encoded size isZero] whileTrue: [encoded
nextPutAll: self getData]. [self isConnected and: [self dataAvailable]]
whileTrue: [encoded nextPutAll: self getData]. object _ ReferenceStream
unStream: encoded contents. ^ object! ! !Socket methodsFor: 'sending-receiving
objects' stamp: 'dgd 2/22/2002 20:28'! sendObject: anObject "sends a
serialized object to this socket" | encoded | encoded _ ReferenceStream
streamedRepresentationOf: anObject. self sendData: encoded! ! !Socket class
methodsFor: 'remoteExamples' stamp: 'edc 2/15/2004 10:53'! remoteCommClient |
newSocket objRec command serverName | Transcript open. Transcript show:
'starting remote comm test'; cr. Transcript show: 'initializing network ...
'. Socket initializeNetwork. Transcript show: 'ok'; cr. serverName :=
'169.254.6.4'. command := FillInTheBlank request: 'Type remote image command'
initialAnswer: ''. newSocket := Socket newTCP. newSocket connectTo:
(NetNameResolver addressForName: serverName) port: 8000. newSocket
waitForConnectionUntil: Socket standardDeadline. Transcript show: 'server start
to perform instructions'; cr. [command = 'FIN'] whileFalse: [Transcript
show: 'Command sended is ' , command; cr. newSocket sendObject: command.
newSocket waitForConnectionUntil: (Socket deadlineSecs: 60). [newSocket
isConnected] whileTrue: [newSocket dataAvailable ifTrue: [newSocket
dataAvailable ifTrue: [objRec := newSocket getObject.
Transcript show: 'Resoonse is ' , objRec printString; cr.
command := FillInTheBlank request: 'Type remote image command' initialAnswer:
'']]]]. newSocket closeAndDestroy! !

Object subclass: #TEGServer instanceVariableNames: 'port process ear socketList
activeClient addClient ' classVariableNames: '' poolDictionaries: ''
category: 'Morphic-TEG'! !TEGServer methodsFor: 'as yet unclassified' stamp:
'edc 4/22/2004 10:58'! addClient: socket | iPAddress | iPAddress _
NetNameResolver stringFromAddress: socket remoteAddress. Transcript show:
iPAddress; tab. Transcript show: socket getData; cr. activeClient _
activeClient + 1. socketList at: iPAddress ifAbsent: [socketList at:
activeClient put: socket]. activeClient = 2 ifTrue: [self ringLoop]! !
!TEGServer methodsFor: 'as yet unclassified' stamp: 'edc 4/22/2004 11:09'!
newEar | socket | socket _ Socket tcpCreateIfFail: [self error: 'Unable to
create a socket']. socket listenOn: port backlogSize: 6. ^ socket! !
!TEGServer methodsFor: 'as yet unclassified' stamp: 'cwp 9/29/2002 19:54'!
newProcess | p | p _ [self serviceLoop] newProcess. p priority: self class
priority. ^ p ! ! !TEGServer methodsFor: 'as yet unclassified' stamp: 'edc
4/15/2004 16:29'! nextClient self halt.! ! !TEGServer methodsFor: 'as yet
unclassified' stamp: 'cwp 9/29/2002 17:38'! port: aPort port _ aPort! !
!TEGServer methodsFor: 'as yet unclassified' stamp: 'edc 4/22/2004 10:59'!
ringLoop | socket objRec iPAddress | [true] whileTrue: [activeClient _
activeClient \\ 2 + 1. socket _ socketList at: activeClient. (socket
isValid and: [socket isConnected]) ifTrue: [socket sendData: 'OK'.
[socket dataAvailable] whileFalse. objRec _ socket getData. iPAddress
_ NetNameResolver stringFromAddress: socket remoteAddress. Transcript show:
iPAddress; tab. Transcript show: objRec printString; cr]]! !
!TEGServer methodsFor: 'as yet unclassified' stamp: 'edc 4/15/2004 16:28'!
serviceLoop | conn | conn _ nil. ear _ self newEar. [true] whileTrue:
[[conn isNil] whileTrue: [conn _ ear waitForAcceptUntil: Socket
standardDeadline]. conn isConnected ifTrue: [ addClient ifTrue:[ self
addClient: conn.] ifFalse:[ self nextClient]. conn _ nil] ifFalse:
[self error: 'Accepted unconnected socket']]! ! !TEGServer methodsFor: 'as yet
unclassified' stamp: 'edc 4/22/2004 10:56'! start Transcript open.
socketList _ Dictionary new. activeClient _ 0. addClient _ true. process
ifNil: [Socket initializeNetwork. process _ self newProcess. process
resume] ifNotNil: [self error: 'TEG Server already started']! ! !TEGServer
methodsFor: 'as yet unclassified' stamp: 'edc 4/15/2004 15:58'! stop process
terminate. process _ nil. ear closeAndDestroy. ear _ nil. ! ! "-- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- "! TEGServer class
instanceVariableNames: ''! !TEGServer class methodsFor: 'defaults' stamp: 'edc
4/22/2004 10:52'! defaultPort ^ 8000! ! !TEGServer class methodsFor:
'defaults' stamp: 'cwp 9/29/2002 19:54'! priority ^ Processor lowIOPriority! !
!TEGServer class methodsFor: 'defaults' stamp: 'edc 4/20/2004 08:43'! start
Transcript open. Transcript show: 'TEGServer starting...';cr. ^ self startOn:
self defaultPort! ! !TEGServer class methodsFor: 'running' stamp: 'cwp
9/29/2002 17:37'! startOn: aPort ^ self new port: aPort; start! ! !TEGServer
class methodsFor: 'running' stamp: 'cwp 11/3/2002 00:20'! stop self
allInstancesDo: [:server | server stop]! !

'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 20 April 2004 at
2:31:53 pm'! "Change Set: RemoteExperiments Date: 3 April 2004 Author: edc
This is a little toy for comand SqueakLight server from a regular image. Uses a
couple of methods by Diego Gomez Deck. lets send and receive objects and with
String complier in remote you can do nice tricks"! Object subclass:
#RemoteClient instanceVariableNames: 'socket serverName ' classVariableNames:
'' poolDictionaries: '' category: 'RemoteExperiments'! !RemoteClient
methodsFor: 'as yet unclassified' stamp: 'edc 4/20/2004 14:22'! initialize |
command | Transcript open. Transcript show: 'starting remote comm test';
cr. Transcript show: 'initializing network ... '. Socket initializeNetwork.
Transcript show: 'ok'; cr. serverName _ 'localhost'. command _ 'UNO'
asByteArray. Transcript show: 'server start to perform instructions'; cr.
self nextCommand: command! ! !RemoteClient methodsFor: 'as yet unclassified'
stamp: 'edc 4/20/2004 11:54'! newCommand ^ FillInTheBlank request: 'Type remote
image command' initialAnswer: ''. ! ! !RemoteClient methodsFor: 'as yet
unclassified' stamp: 'edc 4/20/2004 11:45'! newSocket socket _ Socket newTCP.
socket connectTo: (NetNameResolver addressForName: serverName) port: 5900.
socket waitForConnectionUntil: Socket standardDeadline.! ! !RemoteClient
methodsFor: 'as yet unclassified' stamp: 'edc 4/20/2004 14:24'! nextCommand:
aString | objRec command | command _ aString. [command = 'FIN']
whileFalse: [self newSocket. (socket isValid and: [socket isConnected])
ifTrue: [Transcript show: 'Command sended is ' , command; cr. socket
sendData: command] ifFalse: ["stale connection" socket destroy.
socket _ nil. ]. [socket dataAvailable] whileFalse. objRec _ socket
getData. socket destroy. socket _ nil. objRec = 'WAIT' ifTrue:
[[socket dataAvailable] whileFalse. objRec _ socket getData]. self halt.
Transcript show: 'Response is ' , objRec printString; cr. command _ self
newCommand]! ! !RemoteClient class methodsFor: 'as yet unclassified' stamp:
'edc 2/16/2004 09:53'! new super new initialize! ! !Socket methodsFor:
'receiving' stamp: 'edc 2/15/2004 09:17'! getData | t1 t2 | (self
waitForDataUntil: Socket standardDeadline) ifFalse: [self error: 'getData
timeout']. t1 _ String new: 4000. t2 _ self primSocket: socketHandle
receiveDataInto: t1 startingAt: 1 count: t1 size. ^ t1 copyFrom: 1 to:
t2! ! !Socket methodsFor: 'waiting' stamp: 'jm 3/2/98 18:15'!
waitForConnectionUntil: deadline "Wait up until the given deadline for a
connection to be established. Return true if it is established by the deadline,
false if not." | status | status _ self primSocketConnectionStatus:
socketHandle. [(status = WaitingForConnection) and: [Time millisecondClockValue
< deadline]] whileTrue: [ semaphore waitTimeoutMSecs: (deadline - Time
millisecondClockValue). status _ self primSocketConnectionStatus:
socketHandle]. ^ status = Connected! ! !Socket methodsFor: 'waiting' stamp:
'edc 2/15/2004 09:19'! waitForDataUntil: deadline "Wait up until the given
deadline for data to arrive. Return true if data arrives by the deadline,
false if not." | dataArrived | [self isConnected & (dataArrived := self
primSocketReceiveDataAvailable: socketHandle) not and: ["Connection end and
final data can happen fast, so test in this order " Time
millisecondClockValue < deadline]] whileTrue: [self readSemaphore
waitTimeoutMSecs: deadline - Time millisecondClockValue]. ^ dataArrived! !
!Socket methodsFor: 'sending-receiving objects' stamp: 'dgd 2/22/2002 20:28'!
getObject "gets a serialized object from this socket" | encoded object |
encoded _ String new writeStream. [encoded size isZero] whileTrue: [encoded
nextPutAll: self getData]. [self isConnected and: [self dataAvailable]]
whileTrue: [encoded nextPutAll: self getData]. object _ ReferenceStream
unStream: encoded contents. ^ object! ! !Socket methodsFor: 'sending-receiving
objects' stamp: 'dgd 2/22/2002 20:28'! sendObject: anObject "sends a
serialized object to this socket" | encoded | encoded _ ReferenceStream
streamedRepresentationOf: anObject. self sendData: encoded! ! !Socket class
methodsFor: 'remoteExamples' stamp: 'edc 2/15/2004 10:53'! remoteCommClient |
newSocket objRec command serverName | Transcript open. Transcript show:
'starting remote comm test'; cr. Transcript show: 'initializing network ...
'. Socket initializeNetwork. Transcript show: 'ok'; cr. serverName :=
'169.254.6.4'. command := FillInTheBlank request: 'Type remote image command'
initialAnswer: ''. newSocket := Socket newTCP. newSocket connectTo:
(NetNameResolver addressForName: serverName) port: 8000. newSocket
waitForConnectionUntil: Socket standardDeadline. Transcript show: 'server start
to perform instructions'; cr. [command = 'FIN'] whileFalse: [Transcript
show: 'Command sended is ' , command; cr. newSocket sendObject: command.
newSocket waitForConnectionUntil: (Socket deadlineSecs: 60). [newSocket
isConnected] whileTrue: [newSocket dataAvailable ifTrue: [newSocket
dataAvailable ifTrue: [objRec := newSocket getObject.
Transcript show: 'Resoonse is ' , objRec printString; cr.
command := FillInTheBlank request: 'Type remote image command' initialAnswer:
'']]]]. newSocket closeAndDestroy! !

Reenviar Mensaje #476 de 3344 |
Desplegar mensajes Autor Ordenar por fecha

A todos los interesados, les cuento. Esta mañana hicimos correr con Mauricio en la UTN el primer experimento para el TEG en red. Llevamos una imagen del...
Lic. Edgar J. De Cleene
edgardec2001
Sin conexión Enviar correo
23 de Abr, 2004
6:27 pm
Avanzado

Copyright © 2009 Yahoo! de Argentina S.R.L. Todos los derechos reservados.
Política de privacidad - Condiciones del Servicio - Reglas de la comunidad de Yahoo! - Ayuda