Description
This is the component provided by the Spoofing Card.
Component name: modem
.
This is the component provided by the Spoofing Card.
Component name: modem
.
isWireless(): boolean
Returns whether this modem is capable of sending wireless messages.
isWired(): boolean
Returns whether this modem is capable of sending wired messages.
maxPacketSize(): number
Returns the maximum packet size for sending messages via network cards. Defaults to 8192. You can change this in the OpenComputers configuration file.isOpen(port: number): boolean
Returns whether the specified “port” is currently being listened on. Messages only trigger signals when they arrive on a port that is open.
open(port: number): boolean
Opens the specified port number for listening. Returns true if the port was opened, false if it was already open. Note: maximum port is 65535
close([port: number]): boolean
Closes the specified port (default: all ports). Returns true if ports were closed.
send(address: string, [sourceaddress:string,] port: number[, ...]): boolean
Sends the specified data to the specified target (from the source address if specified)
broadcast([sourceaddress:string,] port: number, ...): boolean
Broadcasts the specified data on the specified port (from the source address if specified)
getStrength(): number
The current signal strength to apply when sending messages. Wireless network cards only.
setStrength(value: number): number
Sets the signal strength. If this is set to a value larger than zero, sending a message will also generate a wireless message. The higher the signal strength the more energy is required to send messages, though. Wireless network cards only.
getWakeMessage():string
Gets the current wake-up message. When the network card detects the wake message (a string in the first argument of a network packet), on any port and the machine is off, the machine is started. Works for robots, cases, servers, drones, and tablets. Linked Cards provide this same functionality.
setWakeMessage(message: string, [fuzzy: boolean]):string
Sets the wake-up message to the specified string. The message matching can be fuzzy (default is false). A fuzzy match ignores additional trailing arguments in the network packet.
modem_message(receiverAddress: string, senderAddress: string, port: number, distance: number, ...)
This signal is queued by network cards (including wireless ones) when they receive a message on an open port.
receiverAddress
is the address of the network card that received the message.
senderAddress
is the address from where the message was sent.
port
is the port on which the message was received.
distance
is the distance only set when receiving wireless network messages.
All further parameters
are user defined and correspond to what the sender specified in modem.send() or modem.broadcast() as the message's payload.