1
0
Fork 0

m2ua: Add some code that is able to send simple M2UA packages

This commit is contained in:
Holger Hans Peter Freyther 2011-03-04 08:06:03 +01:00
parent 30ee798714
commit 64a3fe249c
1 changed files with 19 additions and 0 deletions

19
contrib/m2ua.st Normal file
View File

@ -0,0 +1,19 @@
Eval [
| msg dt socket dgram |
PackageLoader fileInPackage: #Sockets.
PackageLoader fileInPackage: #OsmoNetwork.
msg := Osmo.M2UAMSG fromClass: Osmo.M2UAConstants clsMAUP type: Osmo.M2UAConstants maupData.
msg addTag: (Osmo.M2UATag initWith: Osmo.M2UAConstants tagIdentText data: 'm2ua' asByteArray).
msg addTag: (Osmo.M2UATag initWith: Osmo.M2UAConstants tagData data: #(0 0 0 0 0 0 0 0 0 0) asByteArray).
dt := msg toMessage asByteArray.
dt inspect.
socket := Sockets.DatagramSocket new.
dgram := Sockets.Datagram data: dt.
dgram port: 5001.
dgram address: Sockets.SocketAddress loopbackHost.
socket nextPut: dgram.
]