Commit graph

69 commits

Author SHA1 Message Date
Daniel Murphy
48403470da Unbreak the build - Ignore the fact that MSG_NOSIGNAL is not a member of SocketFlags. 2011-07-09 10:06:19 +10:00
David Nadlinger
5ae54cbf5d Disable SIGPIPE on send()ing to a Socket on OS X.
Previously, std.socket code assumed that MSG_NOSIGNAL existed on all platforms, which is not the case – std.c.osx.socket actually has a comment saying »Not defined in OS X, but we'll use them anyway«. This lead to Socket.send() raising SIGPIPE on OS X if the peer had already closed the connection.

With this commit, std.socket sets the SO_NOSIGPIPE socket option on systems that support it for the same effect as MSG_NOSIGNAL on Linux.

Strictly speaking, removing the NOSIGNAL SocketFlag is a breaking API change, but I do not think there is any code actually using it, as it has always been set implicitly by std.socket anyway.
2011-07-05 15:33:07 +02:00
Daniel Murphy
fd8797a84d Stop using read-modify-write operations on enums in std.socket 2011-06-30 08:12:54 +10:00
David Nadlinger
364bcc872b Fixed c_long->int issue in std.socket – the code was probably written back when D on x86_64 was a faint dream.
Actually, the timeval struct could be removed altogether as it isn't used anywhere in std.socket (I didn't realize that I wasn't using the C standard library one), but this would be still a breaking API change, so I refrained from it.
2011-06-15 21:48:45 +02:00
David Nadlinger
375e9d1212 Fixed x86_64 issue in Socket timeout code. 2011-06-15 21:37:45 +02:00
David Nadlinger
955b112d71 Added InternetAddress.toHostNameString() for looking up the host name.
I am not particularly fond of the method name, but it follows the existing scheme.
2011-06-15 19:51:33 +02:00
David Nadlinger
e5f81404a7 Use new core.sys.posix.netdb. 2011-06-15 19:51:33 +02:00
David Nadlinger
d5b4ceb3b4 Added send/receive timeout socket options.
The strange timeout behavior on Windows (effective timeout = value + ~500ms) has been confirmed on Windows 7, Windows Server 2008 R2 and Windows XP.
2011-06-15 19:51:33 +02:00
David Nadlinger
b34b8bc595 Added cleaned up std.socket.socketPair() unittest as example. 2011-06-15 19:51:33 +02:00
k-hara
a6b4ae4937 More conversions. 2011-06-08 19:57:38 +09:00
k-hara
f833634c03 Change struct const member variables to manifest constants. 2011-06-08 03:03:34 +09:00
David Nadlinger
9b68336a07 Added std.socket.socketPair() which returns a pair of connected sockets. 2011-06-03 01:48:15 +02:00
Walter Bright
046e1b36db add source links 2011-02-06 15:46:50 -08:00
Don Clugston
ed5e3167f0 Don't throw non-Throwables 2011-01-14 08:01:49 +00:00
Steven Schveighoffer
6fb30a1b5e Fixed static destructor so sockets aren't closed on every thread exit in windows. (see bug 4344 and 4951)
Fixed unlisted bug, there could be a race condition on linux with gethostbyname and gethostbyaddr, now synchronizing entire processing of hostent struct.
2010-10-19 13:15:30 +00:00
Shin Fujishiro
50fb1511ed Mark std.socket unittests broken because they succeed or fail depending on running environment. 2010-09-29 04:54:25 +00:00
Shin Fujishiro
1c0cc7c128 Hook a strange HostException failure in win32 unittest.
For some reason std.socket unittest fails with HostException on win32 AutoTester. It used to succeed before; it also succeeds on my environment (FreeBSD, Gentoo and Wine).
2010-09-29 03:36:55 +00:00
David Simcha
9525e76cc5 Fix mysterious compiler crashes when building dfl.socket. The underlying problem is in DMD, though I don't know how to reproduce it. This is just a workaround. 2010-09-15 01:00:30 +00:00
Walter Bright
b8ce58ccd1 detab sources 2010-08-23 02:14:45 +00:00
Andrei Alexandrescu
3f2b8c12ea 64-bit compatibility work 2010-08-22 20:55:22 +00:00
Andrei Alexandrescu
908a8c9366 Fixed failing unittest 2010-07-28 08:08:06 +00:00
Shin Fujishiro
f6b833c8ed Fixed bugzilla 2835: std.socket.TcpSocket doesn't actually connect.
Thanks to Unknown W. Brackets and Alexey Ivanov for the patch!

sockaddr_in.sin_family is auto-initialized with AF_INET only on Windows
(compare std.c.windows.winsock & core.sys.posix.netinet.in_). TcpSocket
should explicitly set sin_family to AF_INET.
2010-05-23 08:09:59 +00:00
Shin Fujishiro
4e2d8f30fd Added FreeBSD code. 2010-05-17 03:02:16 +00:00
Don Clugston
3a1aec52a6 Fixed the workaround. 2010-03-16 07:52:19 +00:00
Walter Bright
cf7c817ca7 socket unittest failure workaround 2010-03-15 21:37:54 +00:00
Sean Kelly
9be950356b Converted "static this" to "shared static this" where appropriate. 2010-03-09 03:54:06 +00:00
Andrei Alexandrescu
02243ab1f3 minor 2009-04-23 09:03:47 +00:00
Walter Bright
a68aeb595b more socket unittest problems 2009-04-19 17:43:10 +00:00
Walter Bright
b47db76c31 epmap on Windows 2009-04-19 17:38:38 +00:00
Andrei Alexandrescu
29480d7df6 minor 2009-04-06 20:45:10 +00:00
Andrei Alexandrescu
6f1c06c040 minor 2009-04-06 17:42:59 +00:00
Sean Kelly
035f8f39c1 Resolved differences between Posix and Windows declarations for BSD socket routines by standardizing on the Posix declaration (which is likely the correct one). This required reverting some changes to std.socket and changing the type of SOCKET from uint to int, which shoudl be fine since they're both 4 bytes anyway. 2009-03-26 18:04:44 +00:00
Sean Kelly
0b1bf3b1d5 2009-03-26 15:13:53 +00:00
Sean Kelly
e108928d21 * Modified all std modules to use core.sys.posix in place of std.c.linux.
* Transformed std.c.linux.* into wrappers around core.sys.posix modules where appropriate.
* Added std.c.osx as the OSX equivalent of std.c.linux.
* Added std.c.osx.socket for OSX-specific socket declarations not covered by the Posix spec.
* Altered all makefiles to zip, etc, the new std.c.osx package.
2009-03-26 03:02:32 +00:00
Sean Kelly
c4a3aab657 The std.c modules now simply wrap the corresponding core.stdc modules to expose standard C declarations. std.c.os remains unchanged thus far, but will likely be altered as well. This unfortunately eliminates the auto doc generation for the std.c modules, since the modules are now largely empty. If the user wants to know what they contain, how the functions work, etc, I suggest for now simply referring to a C library spec--the core.stdc modules conform almost exactly to the C99 library definition. 2009-03-20 18:52:45 +00:00
Walter Bright
8c763e5848 more osx fixes 2009-02-13 03:41:56 +00:00
Walter Bright
d57e203dc9 fold in some OSX changes 2009-02-10 02:21:15 +00:00
Sean Kelly
edb5c5003e This commit includes all the changes necessary for Phobos to run against druntime. Here is a sucinct list of the changes made:
* Removed gcstats.  Garbage collector statistics will be avaialable in durintime's 'memory' module.
    * Removed object.d.  This module is replaced by the object.d provided by druntime.
    * Removed std.array.  To trap an array bounds error, import 'exception' from druntime and catch ArrayBoundsException.
    * Removed std.asserterror.  To trap an asertion failure, import 'exception' from druntime and catch AssertException.
    * Removed std.gc.  To interact with the garbage collector, import 'memory' from druntime.
    * Removed std.hiddenfunc.  No equivalent exception is currently exposed by druntime, but if one is exposed it will be called HiddenFuncException and be declared in 'exception'.
    * Removed std.moduleinit.  druntime declares ModuleInfo in object.d, so it is implicitly availble without importing.
    * Removed std.outofmemory.  To trap an out of memory error, import 'exception' from druntime and catch OutOfMemoryException.
    * Removed std.switcherr.  To trap a switch error, import 'exception' from druntime and catch SwitchException.
    * Removed std.synchro.  This functionality will exist within druintime.
    * Removed std.thread.  A Thread class is available within druntime's 'thread' module.  An interface comparison will be provided separately.
    * Removed std.typeinfo.  The classes defined in this package are for runtime use and should not be visible to the user.

The prior version of Phobos has been archived in tags/phobos-2.019 if needed.
2008-10-11 00:56:40 +00:00
Walter Bright
8d41338d26 fix for bugzilla 2373 2008-10-02 09:10:50 +00:00
Walter Bright
dfe4ed52c7 foo 2008-08-07 17:37:56 +00:00
Walter Bright
75ec4a3c93 updated array op unit tests 2008-07-25 08:28:19 +00:00
Don Clugston
43084b839f Reverted accidental change. Subversion was misbehaving for me. 2008-06-30 20:08:27 +00:00
Don Clugston
0082bfa2f2 Fix to allow random to compile with -cov.
Commented out failing unit tests in bigint (seem to be opAssign with integer arguments).
2008-06-30 20:07:05 +00:00
Walter Bright
c5699455eb needed libraries 2008-05-16 10:35:18 +00:00
Walter Bright
ed3992d9db bugzilla 1749 2007-12-28 10:27:07 +00:00
Brad Roberts
c397f27986 More override warning fixes 2007-10-15 05:16:57 +00:00
Brad Roberts
a9bc53273c merge r387:397 from candidate to trunk
-- new module std.contracts
  -- migrate callers to it where appropriate
2007-10-14 23:04:19 +00:00
Brad Roberts
9fa812d984 Merge r392 from branches/phobos-1.x to trunk.
-- std/socket.d -- synchronization needs to be global and not per class instance
2007-10-14 21:34:32 +00:00
Brad Roberts
eec6be69ed Merge r297:387 from candidate to trunk.
-- add std.getopt
  -- add std.variant
  -- switch strings over to be invariant rather than const
  -- hopefully the last big linux makefile overhaul
  -- fix for bug 1579: write[ln] fails for obj.toString()
  -- fix negative precision handling in std.format
  -- add some file and directory iterator helpers
  -- among other little changes here and there...
2007-10-14 09:22:50 +00:00
Brad Roberts
e665d910ca Merge r355:385 from branches/phobos-1.x to trunk
-- fix for bug 1491 -- sigpipe suppression
  -- fix for bug 1478 -- libc network api threadsafety
  -- add std.socket to the standard unittest set
2007-10-14 05:10:52 +00:00