BaseX for noobs: C++ API ?

Friday, 3 January 2014 · 10 messages · last reply 7 Jan 2014
JM
jean-marc Mercier3 Jan 2014 11:12 #
Hi all, going back to the root... I am trying to connect my favorite C++ tools to BaseX. Unfortunately, I am using visual C++ 12 Express under windows 7. It seems that windows users will not be able to use the existing BaseX API C connector, and need another one. Thus I started to code a C++ BaseX API connector. Writing a API connector is quite difficult for me, since I don't have the required networks knowledge. Has somebody already some code to that purposes ?
DK
Dirk Kirsten3 Jan 2014 11:17 #
Hello Jean-Marc, What problems did you experience when using the provided C API (https://github.com/BaseXdb/basex-api/tree/master/src/main/c) under Windows 7? It should also work under windows. Additionally, you can find the source code of the C API at the basex-api repository, so this should give you a starting point if you ant to rewrite anything. Cheers, Dirk
Quoted text · jean-marc Mercier · 22 lines
On 03/01/14 11:12, jean-marc Mercier wrote: > Hi all, > > going back to the root... I am trying to connect my favorite C++ tools to > BaseX. > Unfortunately, I am using visual C++ 12 Express under windows 7. It seems > that windows users will not be able to use the existing BaseX API C > connector, and need another one. Thus I started to code a C++ BaseX API > connector. > > Writing a API connector is quite difficult for me, since I don't have the > required networks knowledge. > > Has somebody already some code to that purposes ? > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
JM
jean-marc Mercier3 Jan 2014 11:33 #
Hi Dirk, Thanx for your answer. Indeed, I tried to install the existing C API. For windows user : Some *.h, *.c files of the BaseX C API seems to work only with a gcc compiler. Some others one don't even exists under windows, at least I did not found them : 1) the BaseX C API seems to use the open SSL framework. I did download and install it, but have some problem to compile it with Visual C++ Express. 2) Some needed c/h files (see for instance "#include <unistd.h>) are located in the MinGW distribution for windows. However, these files are bound to GCC compiler, and can not be compiled with Microsoft compiler. Indeed, I am trying to mimic in C++ the C# API, that works on my configuration. But it is not easy for me, since I never manipulated sockets and TCP connectors, and will take me a lot of time. Thus, if anyone already did the work, that would be so nice to share :) Cheers, Jean-Marc 2014/1/3 Dirk Kirsten <dk at basex.org>
Quoted text · Dirk Kirsten · 46 lines
> Hello Jean-Marc, > > What problems did you experience when using the provided C API > (https://github.com/BaseXdb/basex-api/tree/master/src/main/c) under > Windows 7? It should also work under windows. > Additionally, you can find the source code of the C API at the basex-api > repository, so this should give you a starting point if you ant to > rewrite anything. > > Cheers, > Dirk > > On 03/01/14 11:12, jean-marc Mercier wrote: > > Hi all, > > > > going back to the root... I am trying to connect my favorite C++ tools to > > BaseX. > > Unfortunately, I am using visual C++ 12 Express under windows 7. It seems > > that windows users will not be able to use the existing BaseX API C > > connector, and need another one. Thus I started to code a C++ BaseX API > > connector. > > > > Writing a API connector is quite difficult for me, since I don't have the > > required networks knowledge. > > > > Has somebody already some code to that purposes ? > > > > > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > > -- > Dirk Kirsten, BaseX GmbH, http://basex.org > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
DK
Dirk Kirsten5 Jan 2014 16:58 #
Hello Jean-Marc, I see your point. Unfortunately, I don't have any experience doing Windows socket programming (nor do I run any Windows OS), so I am of not much help here. But I would guess the C code can be quite easily replaced (e.g. OpenSSL is most likely just used for the md5 computation) and based on some articles like http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin I would guess windows socket programming can be done quite similar to Unix sockets. Cheers, Dirk
Quoted text · jean-marc Mercier · 76 lines
On 03/01/14 11:33, jean-marc Mercier wrote: > Hi Dirk, > > Thanx for your answer. Indeed, I tried to install the existing C API. For > windows user : > > Some *.h, *.c files of the BaseX C API seems to work only with a gcc > compiler. Some others one don't even exists under windows, at least I did > not found them : > 1) the BaseX C API seems to use the open SSL framework. I did download and > install it, but have some problem to compile it with Visual C++ Express. > 2) Some needed c/h files (see for instance "#include <unistd.h>) are > located in the MinGW distribution for windows. However, these files are > bound to GCC compiler, and can not be compiled with Microsoft compiler. > > Indeed, I am trying to mimic in C++ the C# API, that works on my > configuration. But it is not easy for me, since I never manipulated sockets > and TCP connectors, and will take me a lot of time. Thus, if anyone already > did the work, that would be so nice to share :) > > Cheers, > > Jean-Marc > > > > > 2014/1/3 Dirk Kirsten <dk at basex.org> > >> Hello Jean-Marc, >> >> What problems did you experience when using the provided C API >> (https://github.com/BaseXdb/basex-api/tree/master/src/main/c) under >> Windows 7? It should also work under windows. >> Additionally, you can find the source code of the C API at the basex-api >> repository, so this should give you a starting point if you ant to >> rewrite anything. >> >> Cheers, >> Dirk >> >> On 03/01/14 11:12, jean-marc Mercier wrote: >>> Hi all, >>> >>> going back to the root... I am trying to connect my favorite C++ tools to >>> BaseX. >>> Unfortunately, I am using visual C++ 12 Express under windows 7. It seems >>> that windows users will not be able to use the existing BaseX API C >>> connector, and need another one. Thus I started to code a C++ BaseX API >>> connector. >>> >>> Writing a API connector is quite difficult for me, since I don't have the >>> required networks knowledge. >>> >>> Has somebody already some code to that purposes ? >>> >>> >>> >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >> >> -- >> Dirk Kirsten, BaseX GmbH, http://basex.org >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
JM
jean-marc Mercier5 Jan 2014 21:13 #
Dirk, Thx. Well, I am suffering a lot to develop this C++ BaseX API. I did not succeed in installing the openssl MD5 algorithm, but I finally found a MD5 algorithm that seems to work (at least, it seems to compute the MD5 hash for "admin" correctly). However, after two days, I still can't connect to the BaseX server, and can't figure out why... Concerning TCP connectors, I think that it is wiser to use boost::asio library : it is not MS, and seems to becoming the C++ network standard library. Since this C++ BaseX API'fate is to be published (provided we can make it work!), maybe somebody in BaseX team, that have some experience with C++, could have a look to it ? I put the current code at https://github.com/JohnLeM/BaseXCPPAPI, as a bottle in the sea :( 2014/1/5 Dirk Kirsten <dk at basex.org>
Quoted text · Dirk Kirsten · 105 lines
> Hello Jean-Marc, > > I see your point. Unfortunately, I don't have any experience doing > Windows socket programming (nor do I run any Windows OS), so I am of not > much help here. But I would guess the C code can be quite easily > replaced (e.g. OpenSSL is most likely just used for the md5 computation) > and based on some articles like > > http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin > I would guess windows socket programming can be done quite similar to > Unix sockets. > > Cheers, > Dirk > > On 03/01/14 11:33, jean-marc Mercier wrote: > > Hi Dirk, > > > > Thanx for your answer. Indeed, I tried to install the existing C API. For > > windows user : > > > > Some *.h, *.c files of the BaseX C API seems to work only with a gcc > > compiler. Some others one don't even exists under windows, at least I did > > not found them : > > 1) the BaseX C API seems to use the open SSL framework. I did download > and > > install it, but have some problem to compile it with Visual C++ Express. > > 2) Some needed c/h files (see for instance "#include <unistd.h>) are > > located in the MinGW distribution for windows. However, these files are > > bound to GCC compiler, and can not be compiled with Microsoft compiler. > > > > Indeed, I am trying to mimic in C++ the C# API, that works on my > > configuration. But it is not easy for me, since I never manipulated > sockets > > and TCP connectors, and will take me a lot of time. Thus, if anyone > already > > did the work, that would be so nice to share :) > > > > Cheers, > > > > Jean-Marc > > > > > > > > > > 2014/1/3 Dirk Kirsten <dk at basex.org> > > > >> Hello Jean-Marc, > >> > >> What problems did you experience when using the provided C API > >> (https://github.com/BaseXdb/basex-api/tree/master/src/main/c) under > >> Windows 7? It should also work under windows. > >> Additionally, you can find the source code of the C API at the basex-api > >> repository, so this should give you a starting point if you ant to > >> rewrite anything. > >> > >> Cheers, > >> Dirk > >> > >> On 03/01/14 11:12, jean-marc Mercier wrote: > >>> Hi all, > >>> > >>> going back to the root... I am trying to connect my favorite C++ tools > to > >>> BaseX. > >>> Unfortunately, I am using visual C++ 12 Express under windows 7. It > seems > >>> that windows users will not be able to use the existing BaseX API C > >>> connector, and need another one. Thus I started to code a C++ BaseX API > >>> connector. > >>> > >>> Writing a API connector is quite difficult for me, since I don't have > the > >>> required networks knowledge. > >>> > >>> Has somebody already some code to that purposes ? > >>> > >>> > >>> > >>> _______________________________________________ > >>> BaseX-Talk mailing list > >>> BaseX-Talk at mailman.uni-konstanz.de > >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >>> > >> > >> -- > >> Dirk Kirsten, BaseX GmbH, http://basex.org > >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > >> _______________________________________________ > >> BaseX-Talk mailing list > >> BaseX-Talk at mailman.uni-konstanz.de > >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >> > > > > -- > Dirk Kirsten, BaseX GmbH, http://basex.org > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
JM
jean-marc Mercier6 Jan 2014 21:15 #
Hello, I still can't connect to BaseX. I checked that I sent to the server exactly the same bytes than the C# connector that worked on my configuration. Is there any way to make the BaseX server echoing any input request on a particular socket to check exactly what my TCP connector is sending ? 2014/1/5 jean-marc Mercier <jeanmarc.mercier at gmail.com>
Quoted text · jean-marc Mercier · 135 lines
> Dirk, > > Thx. Well, I am suffering a lot to develop this C++ BaseX API. I did not > succeed in installing the openssl MD5 algorithm, but I finally found a MD5 > algorithm that seems to work (at least, it seems to compute the MD5 hash > for "admin" correctly). However, after two days, I still can't connect to > the BaseX server, and can't figure out why... > > Concerning TCP connectors, I think that it is wiser to use boost::asio > library : it is not MS, and seems to becoming the C++ network standard > library. > > Since this C++ BaseX API'fate is to be published (provided we can make it > work!), maybe somebody in BaseX team, that have some experience with C++, > could have a look to it ? I put the current code at > https://github.com/JohnLeM/BaseXCPPAPI, as a bottle in the sea :( > > > > > > > 2014/1/5 Dirk Kirsten <dk at basex.org> > >> Hello Jean-Marc, >> >> I see your point. Unfortunately, I don't have any experience doing >> Windows socket programming (nor do I run any Windows OS), so I am of not >> much help here. But I would guess the C code can be quite easily >> replaced (e.g. OpenSSL is most likely just used for the md5 computation) >> and based on some articles like >> >> http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin >> I would guess windows socket programming can be done quite similar to >> Unix sockets. >> >> Cheers, >> Dirk >> >> On 03/01/14 11:33, jean-marc Mercier wrote: >> > Hi Dirk, >> > >> > Thanx for your answer. Indeed, I tried to install the existing C API. >> For >> > windows user : >> > >> > Some *.h, *.c files of the BaseX C API seems to work only with a gcc >> > compiler. Some others one don't even exists under windows, at least I >> did >> > not found them : >> > 1) the BaseX C API seems to use the open SSL framework. I did download >> and >> > install it, but have some problem to compile it with Visual C++ Express. >> > 2) Some needed c/h files (see for instance "#include <unistd.h>) are >> > located in the MinGW distribution for windows. However, these files are >> > bound to GCC compiler, and can not be compiled with Microsoft compiler. >> > >> > Indeed, I am trying to mimic in C++ the C# API, that works on my >> > configuration. But it is not easy for me, since I never manipulated >> sockets >> > and TCP connectors, and will take me a lot of time. Thus, if anyone >> already >> > did the work, that would be so nice to share :) >> > >> > Cheers, >> > >> > Jean-Marc >> > >> > >> > >> > >> > 2014/1/3 Dirk Kirsten <dk at basex.org> >> > >> >> Hello Jean-Marc, >> >> >> >> What problems did you experience when using the provided C API >> >> (https://github.com/BaseXdb/basex-api/tree/master/src/main/c) under >> >> Windows 7? It should also work under windows. >> >> Additionally, you can find the source code of the C API at the >> basex-api >> >> repository, so this should give you a starting point if you ant to >> >> rewrite anything. >> >> >> >> Cheers, >> >> Dirk >> >> >> >> On 03/01/14 11:12, jean-marc Mercier wrote: >> >>> Hi all, >> >>> >> >>> going back to the root... I am trying to connect my favorite C++ >> tools to >> >>> BaseX. >> >>> Unfortunately, I am using visual C++ 12 Express under windows 7. It >> seems >> >>> that windows users will not be able to use the existing BaseX API C >> >>> connector, and need another one. Thus I started to code a C++ BaseX >> API >> >>> connector. >> >>> >> >>> Writing a API connector is quite difficult for me, since I don't have >> the >> >>> required networks knowledge. >> >>> >> >>> Has somebody already some code to that purposes ? >> >>> >> >>> >> >>> >> >>> _______________________________________________ >> >>> BaseX-Talk mailing list >> >>> BaseX-Talk at mailman.uni-konstanz.de >> >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >>> >> >> >> >> -- >> >> Dirk Kirsten, BaseX GmbH, http://basex.org >> >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >> >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >> >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >> >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >> >> _______________________________________________ >> >> BaseX-Talk mailing list >> >> BaseX-Talk at mailman.uni-konstanz.de >> >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >> > >> >> -- >> Dirk Kirsten, BaseX GmbH, http://basex.org >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >> > >
JM
jean-marc Mercierin reply to Liam R E Quin, 6 Jan 2014, 22:236 Jan 2014 21:35 #
Liam, Thx for your proposal. Unix C++ user can use the already existing BaseX API, that unfortunately don't work for poor Windows users. My program do send information to BaseX server, since the server replies through its log "admin (the user account I am using to log in) -- acces denied". There is probably something in the MD5 algorithm that I am using. However, I checked that the MD5 algorithm computes correctly the hash for 'admin'. If BaseX server could echo the incoming request, that would be of great help, but I don't know how to do this. If nobody knows, I will have to fork the BAseX code and to try compile a server to see what is happening on the server side...that is probably some days of hard works :( 2014/1/6 Liam R E Quin <liam at w3.org>
Quoted text · jean-marc Mercier · 30 lines
> On Mon, 2014-01-06 at 21:15 +0100, jean-marc Mercier wrote: > > Hello, > > > > I still can't connect to BaseX. I checked that I sent to the server > exactly > > the same bytes than the C# connector that worked on my configuration. > > > > Is there any way to make the BaseX server echoing any input request on a > > particular socket to check exactly what my TCP connector is sending ? > I do have an old C program I wrote years ago that saves a copy of data > sent on a socket into a file; I wrote it for Unix but maybe it'd work > for you. There are some packages for Linux that do soemthing similar > too. > > Make sure that you check the return value of every system call you use - > writing to a socket does not necessarily succeed. Make sure also that > your code connects to the right IP address and port - e.g. try > connecting to something like a Web server where you can see the logs, > and sending "GET / HTTP/1.0\r\nAccept: */*\r\n\r\n" at it. Forgetting to > convert addresses and port numbers to network order is sometimes an > issue. > > Liam > > -- > Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ > Pictures from old books: http://fromoldbooks.org/ > Ankh: irc.sorcery.net irc.gnome.org freenode/#xml > >
DK
Dirk Kirstenin reply to jean-marc Mercier, 6 Jan 2014, 21:156 Jan 2014 21:35 #
Hello Jean-Marc, No, there is no such echoing service. Especially, because you sait that you can't connect, so the authentification does not seem to have taken place. So doing anything before authentification would be rather weird. Also, you did not mention _what_ excactly does not work. However, you can use tools like Wireshark (which should also be available on Windows, I guess) to analyze all your traffic (you can also filter for traffic to specific ports, so just relevant stuff is shown to you). Cheers, Dirk
Quoted text · jean-marc Mercier · 149 lines
On 06/01/14 21:15, jean-marc Mercier wrote: > Hello, > > I still can't connect to BaseX. I checked that I sent to the server exactly > the same bytes than the C# connector that worked on my configuration. > > Is there any way to make the BaseX server echoing any input request on a > particular socket to check exactly what my TCP connector is sending ? > > > > 2014/1/5 jean-marc Mercier <jeanmarc.mercier at gmail.com> > >> Dirk, >> >> Thx. Well, I am suffering a lot to develop this C++ BaseX API. I did not >> succeed in installing the openssl MD5 algorithm, but I finally found a MD5 >> algorithm that seems to work (at least, it seems to compute the MD5 hash >> for "admin" correctly). However, after two days, I still can't connect to >> the BaseX server, and can't figure out why... >> >> Concerning TCP connectors, I think that it is wiser to use boost::asio >> library : it is not MS, and seems to becoming the C++ network standard >> library. >> >> Since this C++ BaseX API'fate is to be published (provided we can make it >> work!), maybe somebody in BaseX team, that have some experience with C++, >> could have a look to it ? I put the current code at >> https://github.com/JohnLeM/BaseXCPPAPI, as a bottle in the sea :( >> >> >> >> >> >> >> 2014/1/5 Dirk Kirsten <dk at basex.org> >> >>> Hello Jean-Marc, >>> >>> I see your point. Unfortunately, I don't have any experience doing >>> Windows socket programming (nor do I run any Windows OS), so I am of not >>> much help here. But I would guess the C code can be quite easily >>> replaced (e.g. OpenSSL is most likely just used for the md5 computation) >>> and based on some articles like >>> >>> http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin >>> I would guess windows socket programming can be done quite similar to >>> Unix sockets. >>> >>> Cheers, >>> Dirk >>> >>> On 03/01/14 11:33, jean-marc Mercier wrote: >>>> Hi Dirk, >>>> >>>> Thanx for your answer. Indeed, I tried to install the existing C API. >>> For >>>> windows user : >>>> >>>> Some *.h, *.c files of the BaseX C API seems to work only with a gcc >>>> compiler. Some others one don't even exists under windows, at least I >>> did >>>> not found them : >>>> 1) the BaseX C API seems to use the open SSL framework. I did download >>> and >>>> install it, but have some problem to compile it with Visual C++ Express. >>>> 2) Some needed c/h files (see for instance "#include <unistd.h>) are >>>> located in the MinGW distribution for windows. However, these files are >>>> bound to GCC compiler, and can not be compiled with Microsoft compiler. >>>> >>>> Indeed, I am trying to mimic in C++ the C# API, that works on my >>>> configuration. But it is not easy for me, since I never manipulated >>> sockets >>>> and TCP connectors, and will take me a lot of time. Thus, if anyone >>> already >>>> did the work, that would be so nice to share :) >>>> >>>> Cheers, >>>> >>>> Jean-Marc >>>> >>>> >>>> >>>> >>>> 2014/1/3 Dirk Kirsten <dk at basex.org> >>>> >>>>> Hello Jean-Marc, >>>>> >>>>> What problems did you experience when using the provided C API >>>>> (https://github.com/BaseXdb/basex-api/tree/master/src/main/c) under >>>>> Windows 7? It should also work under windows. >>>>> Additionally, you can find the source code of the C API at the >>> basex-api >>>>> repository, so this should give you a starting point if you ant to >>>>> rewrite anything. >>>>> >>>>> Cheers, >>>>> Dirk >>>>> >>>>> On 03/01/14 11:12, jean-marc Mercier wrote: >>>>>> Hi all, >>>>>> >>>>>> going back to the root... I am trying to connect my favorite C++ >>> tools to >>>>>> BaseX. >>>>>> Unfortunately, I am using visual C++ 12 Express under windows 7. It >>> seems >>>>>> that windows users will not be able to use the existing BaseX API C >>>>>> connector, and need another one. Thus I started to code a C++ BaseX >>> API >>>>>> connector. >>>>>> >>>>>> Writing a API connector is quite difficult for me, since I don't have >>> the >>>>>> required networks knowledge. >>>>>> >>>>>> Has somebody already some code to that purposes ? >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> BaseX-Talk mailing list >>>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>>>> >>>>> >>>>> -- >>>>> Dirk Kirsten, BaseX GmbH, http://basex.org >>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> _______________________________________________ >>>>> BaseX-Talk mailing list >>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>>> >>>> >>> >>> -- >>> Dirk Kirsten, BaseX GmbH, http://basex.org >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>> >> >> >
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
LQ
Liam R E Quinin reply to jean-marc Mercier, 6 Jan 2014, 21:156 Jan 2014 22:23 #
Quoted text · jean-marc Mercier · 8 lines
On Mon, 2014-01-06 at 21:15 +0100, jean-marc Mercier wrote: > Hello, > > I still can't connect to BaseX. I checked that I sent to the server exactly > the same bytes than the C# connector that worked on my configuration. > > Is there any way to make the BaseX server echoing any input request on a > particular socket to check exactly what my TCP connector is sending ?
I do have an old C program I wrote years ago that saves a copy of data sent on a socket into a file; I wrote it for Unix but maybe it'd work for you. There are some packages for Linux that do soemthing similar too. Make sure that you check the return value of every system call you use - writing to a socket does not necessarily succeed. Make sure also that your code connects to the right IP address and port - e.g. try connecting to something like a Web server where you can see the logs, and sending "GET / HTTP/1.0\r\nAccept: */*\r\n\r\n" at it. Forgetting to convert addresses and port numbers to network order is sometimes an issue. Liam
-- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
JM
jean-marc Mercier7 Jan 2014 11:56 #
I finally succeeded connecting to BaseX server. This issue was stupidly due to the last trailing '\0' character in the server time stamp response, messing out the password MD5 computations. 2014/1/7 jean-marc Mercier <jeanmarc.mercier at gmail.com>
Quoted text · Liam R E Quin · 279 lines
> @Dirk thx : I saw this with WireShark, even if I could have realized it > without. > > > 2014/1/7 jean-marc Mercier <jeanmarc.mercier at gmail.com> > >> ahhhh...I finally succeeded ! This was so stupidly due to the last >> trailing '\0' character in the server time stamp response, that was so >> stupidly messed out the password MD5 computations. I do like computers when >> I am loosing two days on such b*******t. >> >> I am actually eating my keyboard .... >> >> >> 2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com> >> >>> I installed WireShark. Thx Dirkk, this should definitively helps me. I >>> keep you informed. >>> >>> >>> 2014/1/6 jean-marc Mercier <jeanmarc.mercier at gmail.com> >>> >>>> Dirk, yes I read it. I also have the C# connector that works, and, even >>>> if it does not compile, the C Unix code. But still I can't connect :( >>>> >>>> >>>> 2014/1/6 Dirk Kirsten <dk at basex.org> >>>> >>>>> One other thing, based on your last mail: Did you have a look at >>>>> >>>>> https://docs.basex.org/wiki/Server_Protocol#Authentication_.28via_cram-md5.29 >>>>> ? >>>>> So the basic thing is that you have to hash the password first and then >>>>> combine the result with the timestamp send by the server and then hash >>>>> again to prevent time-based attacks. >>>>> >>>>> Cheers, >>>>> Dirk >>>>> >>>>> On 06/01/14 21:36, jean-marc Mercier wrote: >>>>> > ah ! nice ! I did not thought about this ! >>>>> > >>>>> > >>>>> > 2014/1/6 Dirk Kirsten <dk at basex.org> >>>>> > >>>>> >> Hello Jean-Marc, >>>>> >> >>>>> >> No, there is no such echoing service. Especially, because you sait >>>>> that >>>>> >> you can't connect, so the authentification does not seem to have >>>>> taken >>>>> >> place. So doing anything before authentification would be rather >>>>> weird. >>>>> >> >>>>> >> Also, you did not mention _what_ excactly does not work. However, >>>>> you >>>>> >> can use tools like Wireshark (which should also be available on >>>>> Windows, >>>>> >> I guess) to analyze all your traffic (you can also filter for >>>>> traffic to >>>>> >> specific ports, so just relevant stuff is shown to you). >>>>> >> >>>>> >> Cheers, >>>>> >> Dirk >>>>> >> >>>>> >> On 06/01/14 21:15, jean-marc Mercier wrote: >>>>> >>> Hello, >>>>> >>> >>>>> >>> I still can't connect to BaseX. I checked that I sent to the server >>>>> >> exactly >>>>> >>> the same bytes than the C# connector that worked on my >>>>> configuration. >>>>> >>> >>>>> >>> Is there any way to make the BaseX server echoing any input >>>>> request on a >>>>> >>> particular socket to check exactly what my TCP connector is >>>>> sending ? >>>>> >>> >>>>> >>> >>>>> >>> >>>>> >>> 2014/1/5 jean-marc Mercier <jeanmarc.mercier at gmail.com> >>>>> >>> >>>>> >>>> Dirk, >>>>> >>>> >>>>> >>>> Thx. Well, I am suffering a lot to develop this C++ BaseX API. I >>>>> did not >>>>> >>>> succeed in installing the openssl MD5 algorithm, but I finally >>>>> found a >>>>> >> MD5 >>>>> >>>> algorithm that seems to work (at least, it seems to compute the >>>>> MD5 hash >>>>> >>>> for "admin" correctly). However, after two days, I still can't >>>>> connect >>>>> >> to >>>>> >>>> the BaseX server, and can't figure out why... >>>>> >>>> >>>>> >>>> Concerning TCP connectors, I think that it is wiser to use >>>>> boost::asio >>>>> >>>> library : it is not MS, and seems to becoming the C++ network >>>>> standard >>>>> >>>> library. >>>>> >>>> >>>>> >>>> Since this C++ BaseX API'fate is to be published (provided we can >>>>> make >>>>> >> it >>>>> >>>> work!), maybe somebody in BaseX team, that have some experience >>>>> with >>>>> >> C++, >>>>> >>>> could have a look to it ? I put the current code at >>>>> >>>> https://github.com/JohnLeM/BaseXCPPAPI, as a bottle in the sea :( >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> 2014/1/5 Dirk Kirsten <dk at basex.org> >>>>> >>>> >>>>> >>>>> Hello Jean-Marc, >>>>> >>>>> >>>>> >>>>> I see your point. Unfortunately, I don't have any experience >>>>> doing >>>>> >>>>> Windows socket programming (nor do I run any Windows OS), so I >>>>> am of >>>>> >> not >>>>> >>>>> much help here. But I would guess the C code can be quite easily >>>>> >>>>> replaced (e.g. OpenSSL is most likely just used for the md5 >>>>> >> computation) >>>>> >>>>> and based on some articles like >>>>> >>>>> >>>>> >>>>> >>>>> >> >>>>> http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin >>>>> >>>>> I would guess windows socket programming can be done quite >>>>> similar to >>>>> >>>>> Unix sockets. >>>>> >>>>> >>>>> >>>>> Cheers, >>>>> >>>>> Dirk >>>>> >>>>> >>>>> >>>>> On 03/01/14 11:33, jean-marc Mercier wrote: >>>>> >>>>>> Hi Dirk, >>>>> >>>>>> >>>>> >>>>>> Thanx for your answer. Indeed, I tried to install the existing >>>>> C API. >>>>> >>>>> For >>>>> >>>>>> windows user : >>>>> >>>>>> >>>>> >>>>>> Some *.h, *.c files of the BaseX C API seems to work only with >>>>> a gcc >>>>> >>>>>> compiler. Some others one don't even exists under windows, at >>>>> least I >>>>> >>>>> did >>>>> >>>>>> not found them : >>>>> >>>>>> 1) the BaseX C API seems to use the open SSL framework. I did >>>>> download >>>>> >>>>> and >>>>> >>>>>> install it, but have some problem to compile it with Visual C++ >>>>> >> Express. >>>>> >>>>>> 2) Some needed c/h files (see for instance "#include >>>>> <unistd.h>) are >>>>> >>>>>> located in the MinGW distribution for windows. However, these >>>>> files >>>>> >> are >>>>> >>>>>> bound to GCC compiler, and can not be compiled with Microsoft >>>>> >> compiler. >>>>> >>>>>> >>>>> >>>>>> Indeed, I am trying to mimic in C++ the C# API, that works on my >>>>> >>>>>> configuration. But it is not easy for me, since I never >>>>> manipulated >>>>> >>>>> sockets >>>>> >>>>>> and TCP connectors, and will take me a lot of time. Thus, if >>>>> anyone >>>>> >>>>> already >>>>> >>>>>> did the work, that would be so nice to share :) >>>>> >>>>>> >>>>> >>>>>> Cheers, >>>>> >>>>>> >>>>> >>>>>> Jean-Marc >>>>> >>>>>> >>>>> >>>>>> >>>>> >>>>>> >>>>> >>>>>> >>>>> >>>>>> 2014/1/3 Dirk Kirsten <dk at basex.org> >>>>> >>>>>> >>>>> >>>>>>> Hello Jean-Marc, >>>>> >>>>>>> >>>>> >>>>>>> What problems did you experience when using the provided C API >>>>> >>>>>>> (https://github.com/BaseXdb/basex-api/tree/master/src/main/c) >>>>> under >>>>> >>>>>>> Windows 7? It should also work under windows. >>>>> >>>>>>> Additionally, you can find the source code of the C API at the >>>>> >>>>> basex-api >>>>> >>>>>>> repository, so this should give you a starting point if you >>>>> ant to >>>>> >>>>>>> rewrite anything. >>>>> >>>>>>> >>>>> >>>>>>> Cheers, >>>>> >>>>>>> Dirk >>>>> >>>>>>> >>>>> >>>>>>> On 03/01/14 11:12, jean-marc Mercier wrote: >>>>> >>>>>>>> Hi all, >>>>> >>>>>>>> >>>>> >>>>>>>> going back to the root... I am trying to connect my favorite >>>>> C++ >>>>> >>>>> tools to >>>>> >>>>>>>> BaseX. >>>>> >>>>>>>> Unfortunately, I am using visual C++ 12 Express under windows >>>>> 7. It >>>>> >>>>> seems >>>>> >>>>>>>> that windows users will not be able to use the existing BaseX >>>>> API C >>>>> >>>>>>>> connector, and need another one. Thus I started to code a C++ >>>>> BaseX >>>>> >>>>> API >>>>> >>>>>>>> connector. >>>>> >>>>>>>> >>>>> >>>>>>>> Writing a API connector is quite difficult for me, since I >>>>> don't >>>>> >> have >>>>> >>>>> the >>>>> >>>>>>>> required networks knowledge. >>>>> >>>>>>>> >>>>> >>>>>>>> Has somebody already some code to that purposes ? >>>>> >>>>>>>> >>>>> >>>>>>>> >>>>> >>>>>>>> >>>>> >>>>>>>> _______________________________________________ >>>>> >>>>>>>> BaseX-Talk mailing list >>>>> >>>>>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> >>>>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>>> >>>>>>>> >>>>> >>>>>>> >>>>> >>>>>>> -- >>>>> >>>>>>> Dirk Kirsten, BaseX GmbH, http://basex.org >>>>> >>>>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> >>>>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> >>>>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael >>>>> Seiferle >>>>> >>>>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> >>>>>>> _______________________________________________ >>>>> >>>>>>> BaseX-Talk mailing list >>>>> >>>>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> >>>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>>> >>>>>>> >>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> Dirk Kirsten, BaseX GmbH, http://basex.org >>>>> >>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> >>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> >>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>>> >>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> >>>>> >>>>> >>>> >>>>> >>>> >>>>> >>> >>>>> >> >>>>> >> -- >>>>> >> Dirk Kirsten, BaseX GmbH, http://basex.org >>>>> >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>>> >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> >> >>>>> > >>>>> >>>>> -- >>>>> Dirk Kirsten, BaseX GmbH, http://basex.org >>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> >>>> >>>> >>> >> >

⚡Generated with XQuery