Re: Sockets between D and C(++) app

2014-04-03 Thread Alexandre L.
On Wednesday, 2 April 2014 at 21:54:58 UTC, FreeSlave wrote: It's only server. Maybe problem is on client side. Yes, it is only a server which needs to answer back the client; And there was the problem: I was not fetching the client's address, and since UDP is an unconnected protocol, I

Re: Signature of main [was Sockets between D and C(++) app]

2014-04-02 Thread Russel Winder
On Wed, 2014-04-02 at 00:34 +, bearophile wrote: Alexandre L.: int main(string[] args) { If you don't need args, then I suggest to not put it as main argument. So probably this is better (note no int nor return, in D they are not needed): void main() { ... } I am not

Re: Signature of main [was Sockets between D and C(++) app]

2014-04-02 Thread bearophile
Russel Winder: what is the real signature in D? The _real_ signature of main() is flexible, you can use: void main() int main(in string[] args) pure nothrow D allows you to omit the args if you don't need them, returns 0 if you don't it, and it can be pure/nothrow/@safe as desired.

Re: Signature of main [was Sockets between D and C(++) app]

2014-04-02 Thread Dicebot
On Wednesday, 2 April 2014 at 08:55:23 UTC, Russel Winder wrote: On Wed, 2014-04-02 at 00:34 +, bearophile wrote: Alexandre L.: int main(string[] args) { If you don't need args, then I suggest to not put it as main argument. So probably this is better (note no int nor return, in D

Re: Signature of main [was Sockets between D and C(++) app]

2014-04-02 Thread Andrej Mitrovic
On 4/2/14, Dicebot pub...@dicebot.lv wrote: D main != C main, latter is implemented in D runtime to call the former. 0 will be also returned by latter, not the former. Actually, the compiler injects a return statement in D's main. It generates the actual C main function (unless WinMain/DllMain

Re: Signature of main [was Sockets between D and C(++) app]

2014-04-02 Thread Ola Fosheim Grøstad
On Wednesday, 2 April 2014 at 08:55:23 UTC, Russel Winder wrote: The real signature of main in C/C++ is, I believe: int main(int, char**, char**) I believe in C it is: int main(void) int main(int,char**) or implementation defined (e.g. the third env pointer in the main signature

Re: Sockets between D and C(++) app

2014-04-02 Thread FreeSlave
It's only server. Maybe problem is on client side. Try this if you are on Linux: //Linux C client #include sys/socket.h #include sys/types.h #include netinet/in.h #include arpa/inet.h #include stddef.h #include string.h #include stdio.h int main() { int sock, res; struct sockaddr_in

Sockets between D and C(++) app

2014-04-01 Thread Alexandre L.
Hello, I lately did a minimal udp socket server-client application with C++, and I've been trying to recreate it with D, after. I'm able to get the client's request (C++ client) without too much trouble (after I figured I needed to get it in ubyte[]). Then I've tried to send the client an

Re: Sockets between D and C(++) app

2014-04-01 Thread bearophile
Alexandre L.: Some comments on your code: Here's my 'server' code: int main(string[] args) { If you don't need args, then I suggest to not put it as main argument. So probably this is better (note no int nor return, in D they are not needed): void main() { ... } int

Re: Sockets between D and C(++) app

2014-04-01 Thread Alexandre L.
On Wednesday, 2 April 2014 at 00:34:08 UTC, bearophile wrote: char[] rep = regan\0.dup; s.send(cast(ubyte[])rep); casts are dangerous, because they silently assume you know what you are doing. As first try I suggest you to remove every cast()

Re: Sockets between D and C(++) app

2014-04-01 Thread Alexandre L.
My bad; It returns immutable(char)*. Still won't work with send(); Am I right to supposed the receiving client must handle a ubyte[] as well (C++) ?

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-25 Thread Jarl André
On Sunday, 24 June 2012 at 23:04:14 UTC, Sean Kelly wrote: On Jun 24, 2012, at 11:40 AM, Jarl André jarl.an...@gmail.com@puremagic.com jarl.an...@gmail.com wrote: Is it wrong to badge myself with asynchronous sockets? :) Nope. It's pretty weird stuff if you've never done event-based

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Jarl André
I have now completely and totally replaced the inner contents of my server library with modified Splat code. It ran so much faster that I was actually afraid I had got it wrong. It seemed not be any wrong with it, so adding Splat actually made it super kidding me fast. I have now learned a few

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Tobias Pankrath
* add -g and -debug=splat (or any other keywords) to the build command You don't need a keyword -debug is sufficient. To make the binary work with a debugger you does not even need -debug, only -g. -debug only includes code that's in a debug-block. * gdb bin/SimpleServer * continue (on

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Jarl André
On Sunday, 24 June 2012 at 19:10:55 UTC, Tobias Pankrath wrote: * add -g and -debug=splat (or any other keywords) to the build command You don't need a keyword -debug is sufficient. To make the binary work with a debugger you does not even need -debug, only -g. -debug only includes code

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Tobias Pankrath
The thing that developers should come from a C/C++ background is totally not acceptable. Yes. I also think the documentation shouldn't assume familiarity with C++. So we need to add a Introduction to D for Java developers etc, that makes it easier to start hacking right away. My question

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Sean Kelly
On Jun 24, 2012, at 11:40 AM, Jarl André jarl.an...@gmail.com@puremagic.com jarl.an...@gmail.com wrote: Is it wrong to badge myself with asynchronous sockets? :) Nope. It's pretty weird stuff if you've never done event-based programming before.

Learning asynchronous sockets in D (well actually C...)

2012-06-23 Thread Jarl André
The learning curve has been from like zero to something. I am still grasping for some fundamental knowledge that I need to fully get whats going on. Had to read documentation for sockets in C to understand anything at all. That says a lot. Coming from BufferedReader hell in Java and did never

Re: Sockets and D?

2009-04-05 Thread downs
Jimi_Hendrix wrote: Hi, I am new to D but not to programming. I have had some socket experience before. How would i connect to a server using sockets in D? A link to a D socket tutorial (if one exists) would also be appreciated. by the way, first post to a newsgroup for me As certain

Sockets and D?

2009-04-02 Thread Jimi_Hendrix
Hi, I am new to D but not to programming. I have had some socket experience before. How would i connect to a server using sockets in D? A link to a D socket tutorial (if one exists) would also be appreciated. by the way, first post to a newsgroup for me

Re: Sockets and D?

2009-04-02 Thread Denis Koroskin
On Fri, 03 Apr 2009 04:19:10 +0400, Jimi_Hendrix myspo...@gmail.com wrote: Hi, I am new to D but not to programming. I have had some socket experience before. How would i connect to a server using sockets in D? A link to a D socket tutorial (if one exists) would also be appreciated

Re: Sockets and D?

2009-04-02 Thread jimi hendrix
On Fri, 03 Apr 2009 04:35:21 +0400, Denis Koroskin wrote: I'd suggest you to look at Tango as it has very impressive networking feature set. tutorial? also what do i need to download to use tango?

Re: Sockets and D?

2009-04-02 Thread Denis Koroskin
On Fri, 03 Apr 2009 04:55:59 +0400, jimi hendrix myspo...@gmail.com wrote: On Fri, 03 Apr 2009 04:35:21 +0400, Denis Koroskin wrote: I'd suggest you to look at Tango as it has very impressive networking feature set. tutorial? also what do i need to download to use tango?