Weird result of getsockopt

2015-05-24 Thread CodeSun via Digitalmars-d-learn
Hello guys, Today, I found a weird problem when I was learning to enable SO_KEEPALIVE for a specific socket. I use setsockopt to enable keepalive firstly, and then use getsockopt to show if it is enabled correctly. My code snippet is listed below: Dlang version: import

Re: Weird result of getsockopt

2015-05-24 Thread CodeSun via Digitalmars-d-learn
On Sunday, 24 May 2015 at 21:11:34 UTC, Daniel Kozak wrote: On Sunday, 24 May 2015 at 16:51:44 UTC, CodeSun wrote: Hello guys, Today, I found a weird problem when I was learning to enable SO_KEEPALIVE for a specific socket. I use setsockopt to enable keepalive firstly, and then use getsockopt

Weird link error

2015-04-20 Thread CodeSun via Digitalmars-d-learn
I have test a snippet of code, and I encountered with a weird link error. The following is the demo: import std.stdio; interface Ti { T get(T)(int num); T get(T)(string str); } class Test : Ti { T get(T)(int num) { writeln(ok); } T

Re: something weird with strerror_r

2015-01-31 Thread CodeSun via Digitalmars-d
On Thursday, 29 January 2015 at 15:25:09 UTC, Mike Parker wrote: On 1/29/2015 11:40 PM, CodeSun wrote: Recently, I found something really weird when I use strerror_t function which is declared inside std.c.string. The code snippet is listed below: import std.c.string; import core.stdc.errno;

something weird with strerror_r

2015-01-29 Thread CodeSun via Digitalmars-d
Recently, I found something really weird when I use strerror_t function which is declared inside std.c.string. The code snippet is listed below: import std.c.string; import core.stdc.errno; void main() { import std.stdio; char[128] buf; strerror_r(errno, buf.ptr,