-----BEGIN PGP SIGNED MESSAGE-----
Hi,
I'm trying to get my Linux box talking to our networked printer which
operates via some undocumented ethernet protocol. I've used tcpdump to
to get an idea of what the packet format is, and I'm now trying to
implement it using sockets etc...
So far, I haven't got very far - the first thing the client software
does is send out an ethernet broadcast message, to check if the
required printer is on-line. I know what the packet should look like,
so I open a socket with a line like
int sock=socket(AF_INET, SOCK_PACKET, htons(ETH_P_ALL);
I then store the header & contents of the packet in the variable
'packet', which gets sent to the network by the command:
sendto(sock, packet, len, 0, &sa, sizeof(sa));
where 'sa' is a struct sockaddr object whose sa_family element is set
to AF_INET.
Basically what I'm doing is using code from libpacket.c out of dosemu
to get this working.
Anyway, simultaneously running tcpdump to check that the packet has been
sent out correctly I get:
22:53:13.085910 0:60:8c:c2:64:9f Broadcast 8086 60:
0003 0000 0000 0700 4849 524f 5331 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000
22:53:13.095910 Broadcast 0:60:8c:c2:64:9f 8086 60:
0903 0000 0000 0053 3120 2020 202d 2d2d
2020 2020 2020 202d 2d2d 2020 2020 2020
2000 0000 0000 0000 0000 0000 0000
The top packet is correct, and is the packet sent out by the 'sendto'
command. The bottom packet, which should be the same as the top, is
corrupted. This causes the printer server not to acknowledge the this
packet, and so the client reckons that the printer is not available.
I've tried running tcpdump on another machine and checking what my
host sends, and I get exactly the same results.
Is this a known problem? If anyone would like to help me out, I can
send the source code, but as it is essentially identical to libpacket.c,
I'm not including it here.
TIA,
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i
iQCVAwUBMebO1mZVEN0KDxVBAQHsDgP/bVSRqY8uDhsf9lhe7X/W6UVPEgSZ1acD
lcfSalFCU25QiK9iouIro76o468dTWY3agmAhlDiGg51304YNhxHn1iWeo2Wvfpw
rVmm96id/dRsCQgk4upem0JlFNkhubbpR0KOnmKVlZXIfFskgvmejKm5HAkb1Dw0
cxHXybcHe2w=
=F+cv
-----END PGP SIGNATURE-----