This component is provided by network cards. Wireless network cards behave much like normal network cards, but additionally send the message as a wireless “packet” when a strength is set. The modem's address must be used for networking. It can be found through component.modem.address.
"foo"is a 5-byte packet; two bytes of overhead and a three byte string.
"currentStatus",300is a 25-byte packet; four bytes overhead, a 13-byte string, and 8 bytes for a number.
isOpen(port: number): boolean
open(port: number): boolean
trueif the port was opened,
falseif it was already open. Note: maximum port is 65535
close([port: number]): boolean
send(address: string, port: number[, ...]): boolean
trueif the message was sent. This does not mean the message was received, only that it was sent. No port-sniffing for you.
broadcast(port: number, ...): boolean
trueif the message was sent. Note that broadcast messages are not delivered to the modem that sent the message.
setStrength(value: number): number
setWakeMessage(message: string, [fuzzy: boolean]):string
This component generates a signal named
modem_message if a message from another network card is received.
It has the signature
localAddress: string, remoteAddress: string, port: number, distance: number, ....
localAddressis the address of the modem component the message was received by.
remoteAddressis the address of the network card the message was sent from.
portis the port number the message was delivered to.
distanceis the distance to the modem that sent the message. This is only set for wireless messages. For normal messages this is always 0.
local component = require("component") local event = require("event") local m = component.modem -- get primary modem component m.open(123) print(m.isOpen(123)) -- true -- Send some message. m.broadcast(123, "this is a test") -- Wait for a message from another network card. local _, _, from, port, _, message = event.pull("modem_message") print("Got a message from " .. from .. " on port " .. port .. ": " .. tostring(message))
|Components||3D Printer - Abstract Bus - Access Point - Chunkloader - Computer - Crafting - Data Card - Database - Debug - Drone - Drive - EEPROM - Experience - Filesystem - Generator - Geolyzer - GPU - Hologram - Internet - Inventory Controller - Leash - Microcontroller - Modem - Motion Sensor - Navigation - Net Splitter - Piston - Redstone - Redstone in Motion - Robot - Screen - Sign - Tank Controller - Tractor Beam - Transposer - Tunnel - World Sensor|
|Others||Component Access - Signals|
|Cross-Mod Integration||Applied Energistics|