[jcifs] The Windows Messenger Problem, Part 2
Sascha Teifke
mailinglist at teifke.de
Sun Jun 22 08:09:05 EST 2003
Hello List,
ok, I did some studies in Java becaus it doesn't seem right to me to ask
stupid questions about my Problem
without knowing any about Java. So I read a few books, did some Java
Hacking and have written some
easier progs. But know I want to look right back to my former problem.
I want to send Data to the Windows Messenger Service.
There are two possibilities to send messages to the Messenger Service:
1) Writing to the Mailslot /MAILSLOT/messngr ( JCIFS ? )
2) Using MS-RPC ( remoteTea ? )
Here is my up to date Sourcecode for 1) but it doesn't work and I want
to ask you for a pointer into the
right direction.
Thank you for your help ...
Sascha
===============START================
/*
* Send Data to the Windows Messenger Service
* who resides at the Mailslot called messngr
*/
import jcifs.smb.SmbNamedPipe;
import java.io.OutputStream;
import java.io.FileInputStream;
public class JNetSend {
public static void main ( String[] args ) throws Exception {
// My Hostname: macbeth
// Read Input from File
// It contains:
// MACBETH\0MACBETH\0Test234\0\0
// with no \n at end of line
String filename = "d:/test.txt";
FileInputStream fin = new FileInputStream ( filename );
// provide 64kB
byte[] b = new byte[65535];
// Open the Mailslot to the Messenger Service
SmbNamedPipe pipe = new SmbNamedPipe(
"smb://macbeth/IPC$/MAILSLOT/messngr",
SmbNamedPipe.PIPE_TYPE_WRONLY );
// Get the Output Handle
OutputStream out = pipe.getNamedPipeOutputStream();
// Read File's input into the provided Byte
int n = fin.read ( b );
// Show me how much it is
System.out.println( "write " + n + " bytes" );
// and write it ..
out.write ( b, 0, n);
// Close the Handles
out.close();
fin.close();
}
}
===============END=====================
More information about the jcifs
mailing list