Skip to content
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

Any client sample? #87

Open
caixiao7 opened this issue Dec 19, 2022 · 1 comment
Open

Any client sample? #87

caixiao7 opened this issue Dec 19, 2022 · 1 comment

Comments

@caixiao7
Copy link

Hi
Thanks for this project.
I saw this issue and tried to implement as it mentioned.However I failed.
I was using debugpy as a dap server . When dap::AttachRequest was sending, It stucked into the function dap::Session::send and I did not know why.
It would be kind of you giving a client sample or some suggestions, thanks

@ben-clayton
Copy link
Contributor

Hi @caixiao7 ,

Sorry for the very slow reply. I somehow missed this.

There's a small example of a client sending a request to the server here:

auto client = dap::net::connect("localhost", kPort);
if (!client) {
printf("Couldn't connect to server\n");
return 1;
}
// Attach a session to the client socket.
auto session = dap::Session::create();
session->bind(client);
// Set an initialize request to the server.
auto future = session->send(dap::InitializeRequest{});
printf("Client sent initialize request to server\n");
printf("Waiting for response from server...\n");
// Wait on the response.
auto response = future.get();
printf("Response received from server\n");
printf("Disconnecting...\n");
// Disconnect.
session->send(dap::DisconnectRequest{});
return 0;

We could certainly do with more example code.

If you're still having issues please let me know. I'll try my best to respond more quickly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants