-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples? #1
Comments
what code do you have right now? |
I'm having trouble getting these functions to work in some circumstances.. However just last night I discovered that if use the extern(c) functions from your module directly ( For this example, I want to take in 2-3 args from command line: Port to open socket on, snapshot to send and optionally a "from" snapshot. So the command looks like The following does what I want, using the lzc functions import core.thread;
import std.conv;
import std.stdio;
import std.socket;
import std.string;
import symmetry.api.libzfs_core;
void main(string[] args) {
if (args.length < 3)
exit(1);
Socket server = new TcpSocket();
Socket client;
server.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true);
server.bind(new InternetAddress(InternetAddress.ADDR_ANY, to!ushort(args[1])));
server.listen(10);
assert(datasetExists(args[2]));
while(true) {
writeln("Waiting for client");
try {
client = server.accept();
if (args.length >= 4) // Incremental
lzc_send(args[2].toCString, args[3].toCString, cast(int)client.handle, cast(lzc_send_flags)0);
else // Single
lzc_send(args[2].toCString, null, cast(int)client.handle, cast(lzc_send_flags)0);
} catch (Exception e) {
logError("error: %s", e.msg);
logError("sockerr: %s", server.getErrorText());
}
client.close();
}
} But if I use the
Any thoughts? Thanks! |
Huh, the implementation of that function is similar to what you had: My guess is that fromSnapshot being "" just might be a problem. Perhaps that is being interpreted differently than ORIGINAL FUNCTION
NEW FUNCTION
and lemme know? This looks like the only real difference between teh function in there and the function you have working. |
Yes I based my code off of the implementation of your I should be able to try your alternate code tomorrow, or the weekend at the latest |
Hello! Could you please provide a working example using both
sendSnapshot()
andreceive()
from the libzfs_core module with a simple TCP socket?I've been trying to make this work and I don't know what I'm doing wrong. I can make it work using plain C with libzfs_core.. any advice would be appreciated!
The text was updated successfully, but these errors were encountered: