|
|||
|
When trying to broadcast using the following code I am not seeing any data been even been sent from my network card (snooping using Ethereal). Please help.
Code:
var s = new Socket; s.create(1364, $SOCK_DGRAM); var stream = new StringStream(); stream.write(0x09, 0x2b, .... 0x01); s.sendTo(stream, stream.length, 64512); |
|
|||
|
Hi, the socket must get the broadcast permission by using the setSockOpt method.
Code:
var s = new Socket;
s.create(1364, $SOCK_DGRAM);
s.setSockOpt(0x0020, 1);
var s2 = new Socket;
s2.create(64512, $SOCK_DGRAM);
s2.onReceive = function ()
{
var st = new StringStream;
this.receiveFrom(st, 65536);
trace(st);
}
var stream = new StringStream();
stream.write("hello");
s.sendTo(stream, stream.length, 64512);
|
|
|||
|
Wow, thanks for the quick reply - what service!
That worked, now my next problem is when I send a byte using stream.write(0x09,0x2b...); it's showing 3 blank (00) bytes between each value sent. How do I stop this? |
|
|||
|
I have implimented this and am getting a reply but for some reason I the SWFKit app not seeing all the data in the reply packet (only getting 42 bytes not 83 that I should be). Can you tell me why this would be occuring?
|
|
|||
|
Hi, it works ok now. Please check mail.
Code:
var s2 = new Socket;
s2.create(64512, $SOCK_DGRAM);
s2.st = new StringStream;
s2.onReceive = function ()
{
this.receiveFrom(this.st, 65535);
if (this.st.length >= 126)
{
trace(this.st.length);
for (i = 0; i < this.st.length; i++)
{
var value = this.st.get();
var s = value.format("0x%02x");
trace(s);
}
//reset the stringstream
this.st.length = 0;
this.st.getPos = this.st.putPos = 0;
}
}
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|