I know that the protocol for the PC client consists of j, c, b, and f commands and I understand what they all d, but no where except for reading the chat source can I find the protocol for CalcNetChat and I don't really understand the source. I think messages are all broadcasted even though I thought it would make more sense to have a join msg brodcasted then everyone replies and ok, everyone takes note of the new "iP" and the new calc takes note of all the received "iP"s. But I don't understand the like format of the actuall msg. Lets say a calc with name "ti-kid" wanted to send "Hello guys". What bytes are ti-kid's calculator putting into the send buffer?
The contents of a text message are literally just the text that should be displayed by anybody who receives the message.
The data model I reverse-engineered when I was rewriting the gCn computer-side tools:
Code:
The data model I reverse-engineered when I was rewriting the gCn computer-side tools:
Code:
class MessageKind(IntEnum):
PING = 0xAB
DISCONNECT = 0xAC
TEXT = 0xAD
@dataclass(frozen=True)
class Message(ABC):
source: Address
destination: Address
@abstractmethod
def __bytes__(self):
raise NotImplementedError() # pragma: nocover
@dataclass(frozen=True)
class PingMessage(Message):
nickname: str
def __bytes__(self):
return (
bytes((MessageKind.PING,)) + (self.nickname.encode("ascii") + bytes(8))[:8]
)
@dataclass(frozen=True)
class DisconnectMessage(Message):
def __bytes__(self):
return bytes((MessageKind.DISCONNECT,))
@dataclass(frozen=True)
class TextMessage(Message):
nickname: str
text: str
def __bytes__(self):
return (
bytes((MessageKind.TEXT,))
+ self.nickname.encode("ascii")
+ b":"
+ self.text.encode("ascii")
)
タリ ·· digipres.club
It's pretty opaque, but you can deduce the protocol from https://github.com/KermMartian/gCn/blob/master/gcnirc/gcnirc.py , namely the gcnpost() and run() functions:
- Message 0xAB: Ping. Message type byte is followed by a username as the remaining bytes of the message (appears to not be zero-terminated?). Indicates that this user remains connected to chat and has not timed out. Also acts as a join message, if a given peer hasn't seen that user before.
- Message 0xAC: Disconnect. No other body data after the message type byte. The client is responsible for remembering what username corresponded to this calculator ID, if it wants to show a message about the user disconnecting.
- Message 0xAD: Message. The message type byte is followed by a zero-terminated message.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement







