At 12:05 AM +0200 9/12/00, Bjarne Nyquist wrote:
>?> 1, how did you recieve the parameter. (can't tell what happen without
>looking into you script)
>Dead on - I made a mistake in a callbackhandler that set my props to void
>(isn? it always the stupid programmers fault?)
>
>
>But I have two other questions on the multi user server.
>1.
>I cant find out how I can make the movie wait until a network action
>really happens. When my moive starts it connects to the server and after
>that it retreives a small amount of data from one of the servers databases.
>Now if the connection takes some time the database (of course) won?
>respond. How do I wait for the connection to be established befor I call
>the database?

Hey Bjarne!

First, you should probably avoid using the built in library palette
behaviors until you get your feet more wet with the Multiuser Xtra.  While
they are excellent, self-contained modules of code there are some tricky
aspects to building additional code which utilizes the connections that
they create.

Here's a simple model to consider using:

1) Make an instance of the Xtra and begin an attempt to connect to a SMU
server:

global gClientConnection

on initClient
  gClientConnection = new( xtra "Multiuser" )
  if objectP( gClientConnection ) then
    -- establish the buffers needed
    gClientConnection.setNetBufferLimits(1024 * 4, 1024 * 4, 5)
    -- set up our default message
    gClientConnection.setNetMessageHandler( #muMessage, 0, 0, 0, TRUE )
    -- filter for connection to server results
    gClientConnection.setNetMessageHandler( #logonToHost, 0,
"ConnectToNetServer", 0, TRUE )
    -- create a timeout object to process connections
    errCode = gClientConnection.connectToNetServer("host.yourdomain.com,
1626, [#userID : "yourNameHere", #password : "password", #movieID :
"yourMovieIDHere"], #smus, "encryptionKey")
    testForError errCode
  else
    alert "Couldn't make an instance of the Multiuser Xtra!"
  end if
end initClient

-- this tests for any Multiuser Xtra error that occurs
on testForError errorCode
  if ( errorCode <> 0 ) then
    showStatus #alert, "MU ERROR:" && gClientConnection.getNetErrorString(
errorCode )
  end if
end testForError


2) Wait for a response by looping on a frame or doing something similar.
NOT in a repeat loop.

3) When you receive a notification message, determine what to do next:

-- this generically handles any incoming messages not otherwise trapped
on muMessage me, newMessage
  testForError newMessage.errorCode
  alert "UNEXPECTED Message Received by Pager:" && string( newMessage )
end muMessage

-- check to see if we are able to connect as a client
on logonToHost me, newMessage
  testForError newMessage.errorCode
  if newMessage.errorCode = 0 then
    alert "Connected to Host!"
    -- now implemented your next course of action
    -- such as sending a database message
    -- implement setNetMessageHandler filters as needed to manage
    -- incoming messages indication completion status for your database actions
  else
    alert "Connection to Host attempt failed."
  end if
end logonToHost

HTH,

Terry

P.S.  I run a mailing list dedicated to the Multiuser Server and Xtra.
Sign up details are posted at http://www.trevimedia.com/mailinglists/

-- 

...---===|    Terry R. Schussler    |===---...
...---===|  DIA Chief Investigator  |===---...

on visitWebsite yourSelection
 coolSites = [ \
   #greatSeminars : "http://www.macromediaSEMINARS.com/", \
   #directorIntelligenceAgency: "http://www.director8.com", \
   #freeBehaviors : "http://www.behaviors.com/"]
 gotoNetPage coolSites[yourSelection]
end visitWebsite


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to