🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #5206

Re: How to make a TClientSocket to search a TServerSocket???

#5206
From: Mark Jacobs
Date: Fri, 01 Oct 2004 08:35
194 lines
11063 bytes
Hi dude, my errorcode is a bit more informative :-
//---------------------------------------------------------------------------
void __fastcall TForm1::ClientSocket1Error(TObject *Sender,
      TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int &ErrorCode)
{
  ShowMessage(mjwinsockerr(ErrorCode)); ErrorCode=0;
}
//---------------------------------------------------------------------------

And, now, I bet you're dying for the mjwinsockerr routine, which translates a
Winsock error into an English description of what went wrong. Well, I'm in a
kind mood today, so here it is :-

AnsiString mjwinsockerr(int lser)
{
  switch (lser)
  {
    case 10004: return "!! A blocking operation was interrupted by a call to
WSACancelBlockingCall.";
    case 10009: return "!! The file handle supplied is not valid.";
    case 10013: return "!! An attempt was made to access a socket in a way
forbidden by its access permissions.";
    case 10014: return "!! The system detected an invalid pointer address in
attempting to use a pointer argument in a call.";
    case 10022: return "!! An invalid argument was supplied.";
    case 10024: return "!! Too many open sockets.";
    case 10035: return "!! A non-blocking socket operation could not be
completed immediately.";
    case 10036: return "!! A blocking operation is currently executing.";
    case 10037: return "!! An operation was attempted on a non-blocking socket
that already had an operation in progress.";
    case 10038: return "!! An operation was attempted on something that is not
a socket.";
    case 10039: return "!! A required address was omitted from an operation on
a socket.";
    case 10040: return "!! A message sent on a datagram socket was larger than
the internal message buffer or some other network limit, or the buffer used to
receive a datagram into was smaller than the datagram itself.";
    case 10041: return "!! A protocol was specified in the socket function
call that does not support the semantics of the socket type requested.";
    case 10042: return "!! An unknown, invalid, or unsupported option or level
was specified in a getsockopt or setsockopt call.";
    case 10043: return "!! The requested protocol has not been configured into
the system, or no implementation for it exists.";
    case 10044: return "!! The support for the specified socket type does not
exist in this address family.";
    case 10045: return "!! The attempted operation is not supported for the
type of object referenced.";
    case 10046: return "!! The protocol family has not been configured into
the system or no implementation for it exists.";
    case 10047: return "!! An address incompatible with the requested protocol
was used.";
    case 10048: return "!! Only one usage of each socket address
(protocol/network address/port) is normally permitted.";
    case 10049: return "!! The requested address is not valid in its
context.";
    case 10050: return "!! A socket operation encountered a dead network.";
    case 10051: return "!! A socket operation was attempted to an unreachable
network.";
    case 10052: return "!! The connection has been broken due to keep-alive
activity detecting a failure while the operation was in progress.";
    case 10053: return "!! An established connection was aborted by the
software in your host machine.";
    case 10054: return "!! An existing connection was forcibly closed by the
remote host.";
    case 10055: return "!! An operation on a socket could not be performed
because the system lacked sufficient buffer space or because a queue was
full.";
    case 10056: return "!! A connect request was made on an already connected
socket.";
    case 10057: return "!! A request to send or receive data was disallowed
because the socket is not connected and (when sending on a datagram socket
using a sendto call) no address was supplied.";
    case 10058: return "!! A request to send or receive data was disallowed
because the socket had already been shut down in that direction with a
previous shutdown call.";
    case 10059: return "!! Too many references to some kernel object.";
    case 10060: return "!! A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond.";
    case 10061: return "!! No connection could be made because the target
machine actively refused it.";
    case 10062: return "!! Cannot translate name.";
    case 10063: return "!! Name component or name was too long.";
    case 10064: return "!! A socket operation failed because the destination
host was down.";
    case 10065: return "!! A socket operation was attempted to an unreachable
host.";
    case 10066: return "!! Cannot remove a directory that is not empty.";
    case 10067: return "!! A Windows Sockets implementation may have a limit
on the number of applications that may use it simultaneously.";
    case 10068: return "!! Ran out of quota.";
    case 10069: return "!! Ran out of disk quota.";
    case 10070: return "!! File handle reference is no longer available.";
    case 10071: return "!! Item is not available locally.";
    case 10091: return "!! WSAStartup cannot function at this time because the
underlying system it uses to provide network services is currently
unavailable.";
    case 10092: return "!! The Windows Sockets version requested is not
supported.";
    case 10093: return "!! Either the application has not called WSAStartup,
or WSAStartup failed.";
    case 10101: return "!! Returned by WSARecv or WSARecvFrom to indicate the
remote party has initiated a graceful shutdown sequence.";
    case 10102: return "!! No more results can be returned by
WSALookupServiceNext.";
    case 10103: return "!! A call to WSALookupServiceEnd was made while this
call was still processing. The call has been canceled.";
    case 10104: return "!! The procedure call table is invalid.";
    case 10105: return "!! The requested service provider is invalid.";
    case 10106: return "!! The requested service provider could not be loaded
or initialized.";
    case 10107: return "!! A system call that should never fail has failed.";
    case 10108: return "!! No such service is known. The service cannot be
found in the specified name space.";
    case 10109: return "!! The specified class was not found.";
    case 10110: return "!! No more results can be returned by
WSALookupServiceNext.";
    case 10111: return "!! A call to WSALookupServiceEnd was made while this
call was still processing. The call has been canceled.";
    case 10112: return "!! A database query failed because it was actively
refused.";
    case 11001: return "!! No such host is known.";
    case 11002: return "!! This is usually a temporary error during hostname
resolution and means that the local server did not receive a response from an
authoritative server.";
    case 11003: return "!! A non-recoverable error occurred during a database
lookup.";
    case 11004: return "!! The requested name is valid and was found in the
database, but it does not have the correct associated data being resolved
for.";
    case 11005: return "!! At least one reserve has arrived.";
    case 11006: return "!! At least one path has arrived.";
    case 11007: return "!! There are no senders.";
    case 11008: return "!! There are no receivers.";
    case 11009: return "!! Reserve has been confirmed.";
    case 11010: return "!! Error due to lack of resources.";
    case 11011: return "!! Rejected for administrative reasons - bad
credentials.";
    case 11012: return "!! Unknown or conflicting style.";
    case 11013: return "!! Problem with some part of the filterspec or
providerspecific buffer in general.";
    case 11014: return "!! Problem with some part of the flowspec.";
    case 11015: return "!! General QOS error.";
    case 11016: return "!! An invalid or unrecognized service type was found
in the flowspec.";
    case 11017: return "!! An invalid or inconsistent flowspec was found in
the QOS structure.";
    case 11018: return "!! Invalid QOS provider-specific buffer.";
    case 11019: return "!! An invalid QOS filter style was used.";
    case 11020: return "!! An invalid QOS filter type was used.";
    case 11021: return "!! An incorrect number of QOS FILTERSPECs were
specified in the FLOWDESCRIPTOR.";
    case 11022: return "!! An object with an invalid ObjectLength field was
specified in the QOS provider-specific buffer.";
    case 11023: return "!! An incorrect number of flow descriptors was
specified in the QOS structure.";
    case 11024: return "!! An unrecognized object was found in the QOS
provider-specific buffer.";
    case 11025: return "!! An invalid policy object was found in the QOS
provider-specific buffer.";
    case 11026: return "!! An invalid QOS flow descriptor was found in the
flow descriptor list.";
    case 11027: return "!! An invalid or inconsistent flowspec was found in
the QOS provider specific buffer.";
    case 11028: return "!! An invalid FILTERSPEC was found in the QOS
provider-specific buffer.";
    case 11029: return "!! An invalid shape discard mode object was found in
the QOS provider specific buffer.";
    case 11030: return "!! An invalid shaping rate object was found in the QOS
provider-specific buffer.";
    case 11031: return "!! A reserved policy element was found in the QOS
provider-specific buffer.";
    default : return "!! Unknown Socket Error "+AnsiString(lser);
  }
}

-- 
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk

"Byanex" <chikui@bol.com.br> wrote in message
news:41596530$1@newsgroups.borland.com...
| Error problem solved, just making:
|
| void __fastcall TForm1::ClientSocket1Error(TObject *Sender,
|       TCustomWinSocket *Socket, TErrorEvent ErrorEvent,
| int &ErrorCode)
| {
|     ErrorCode=0;
| }
|
| On the "OnError" event.
Technical Details
Message-ID: <415d16cd@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41595ce4$1@newsgroups.borland.com> <41595eed$1@newsgroups.borland.com> <41596530$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,bd4b4d9b4b503463
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mark Jacobs" <http://www.jacobsm.com/mjmsg?Borland%20Newsgroup>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41595ce4$1@newsgroups.borland.com> <41595eed$1@newsgroups.borland.com> <41596530$1@newsgroups.borland.com>
Subject: Re: How to make a TClientSocket to search a TServerSocket???
Date: Fri, 1 Oct 2004 09:35:51 +0100
Lines: 196
Organization: DK Computing
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 81.144.157.8
Message-ID: <415d16cd@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1096619725 81.144.157.8 (1 Oct 2004 01:35:25 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail