Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
SMARTSCRIPT
Special Edition Using Macromedia Director 8
Fake-3D Motion
Graphic Puzzle Dragger
Sprite Recorder
Dialog Xtra
Lingo Library
Play/Pause/Rewind Video Sprite
Slider-Alphamania
INSIDE Macromedia Director & Lingo
 

 

 

Xtra TCP UDP Xtra

Added on 4/7/2007

 

Compatibilities:
D7 D8 D8_5 D9 PC Shockwave

This item has not yet been rated

Author: kfink (website)

This is a scripting xtra for Macromedia/Adobe Director. This extra provides communication between two hosts using either TCP or UDP.

Price: $0
Mediamacros makes no guarantees that this price is correct

Get the Xtra
TCP UDP Xtra

ABOUT

Created by Kevin Richard Fink
April 5th 2007

THIS XTRA IS PROVIDED AS IS, WITHOUT ANY IMPLIED WARRANTEE! FOLLOW INSTRUCTIONS CAREFULLY AND USE AT YOUR OWN RISK!

This is a work in progress xtra, as such some features are not yet fully operational. Here is the current status of each call:


Complete features: (stable)

GetLocalIP() -- Returns the IP address of the pc

SendUDPMessage(ip, port, msg) -- Sends a string over UDP

SendTCPMessage(ip, port, msg) -- Sends a string over TCP

HasNext() -- Returns true if their are any messages received from UDP,
TCP or HID USB

GetNext() -- Returns the next message in the queue received from UDP,
TCP or HID USB

DestroyAllThreads() -- Stops all UDP, TCP, and HID communications

WaitForUDP(port) -- Waits for a connection on TCP, DO NOT RUN TWO
THREADS ON THE SAME PORT EVER!

WaitForTCP(port) -- Waits for a connection on TCP, DO NOT RUN TWO
THREADS ON THE SAME PORT EVER!

GetListOfHIDDevices() -- Returns the VendorID, VersionNumber and
ProductID of all HID devices connected to your computer.

CheckWord(Word) -- Returns true if the word is spelled correctly

GetSuggestions(word) -- Returns a list of words closely matching
the specified word.


INSTALLATION

Simply extract and copy "TCPUDPXtra.x32" to your xtra directory of your Director Installation


HOW TO USE

-----------------------------------------------------------------------------
WaitForUDP (Object me, Integer PortNumber)

DESCRIPTION:

This function creates a thread that looks for UDP messages on the
requested port.

USAGE:
object = new(xtra "ControlXtra")
object.WaitForUDP( 1627 )

NOTE:
To retrieve messages you will have to use getNext() and
hasNext().

-----------------------------------------------------------------------------
WaitForTCP (Object me, Integer PortNumber)

DESCRIPTION:

This function creates a thread that looks for TCP messages on the
requested port.

USAGE:
object = new(xtra "ControlXtra")
object.WaitForUDP( 1627 )

NOTE:
To retrieve messages you will have to use getNext() and
hasNext().

-----------------------------------------------------------------------------
SendUDPMessage (Object me, String IP, Integer PortNumber, String Message)

DESCRIPTION:

This function sends a UDP packet containing your message to the
specified port

USAGE:
object = new(xtra "ControlXtra")
object.sendUDPMessage("192.168.0.100", 1627, "MY MESSAGE")

-----------------------------------------------------------------------------
SendTCPMessage (Object me, String IP, Integer PortNumber, String Message)

DESCRIPTION:

This function sends a TCP packet containing your message to the
specified port

USAGE:
object = new(xtra "TCPUDPXtra")
object.sendTCPMessage("192.168.0.100", 1627, "MY MESSAGE")

-----------------------------------------------------------------------------
HasNext (Object me)

DESCRIPTION:

This function returns true if their are messages that have not yet
been processed.

USAGE:
on startMovie
global object
object = new(xtra "TCPUDPXtra")
object.waitForUDP(1627)
object.sendUDPMessage("192.168.0.100", 1627, "HERE IS A SAMPLE MESSAGE")
end

on enterFrame me
global object
if object.hasNext() then
alert "THERE IS A NEW MESSAGE!!"
end if
end

-----------------------------------------------------------------------------
GetNext (Object me)

DESCRIPTION:

This function returns any messages that have not yet been sent to
director, or -1 if their is no messages. For USB it will return a string, for
TCP/UDP it will return a message in the format [message, sourceIP]

USAGE:
on startMovie
global object
object = new(xtra "TCPUDPXtra")
object.waitForUDP(1627)
object.sendUDPMessage("192.168.0.100", 1627, "HERE IS A SAMPLE MESSAGE")
end

on enterFrame me
global object
if object.hasNext() then
alert object.getNext()
end if
end

-----------------------------------------------------------------------------
DestroyAllThreads (Object me)

DESCRIPTION:

Basically a closing parameter in this application, it ensures that the memory is
cleaned of any remaining unread messages and closes all open ports that it was using.

USAGE:
on startMovie
global object
object = new(xtra "TCPUDPXtra")
object.waitForUDP(1627)
object.sendUDPMessage("192.168.0.100", 1627, "HERE IS A SAMPLE MESSAGE")
end

on enterFrame me
global object
if object.hasNext() then
alert object.getNext()
end if
end

on StopMovie
global object
if object <> void then
object.DestroyAllThreads()
end if
end


 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail