Size: a a a

2020 December 16

VG

Vadim Goncharov in Modern::Perl
для решения прикладных задач вовсе не надо повторять реализацию tcp
источник

VG

Vadim Goncharov in Modern::Perl
достаточно грамотно пользоваться самим tcp
источник

a

allter in Modern::Perl
Vadim Goncharov
ERRORS
    The connect() system call fails if:

    [EBADF]            The s argument is not a valid descriptor.

    [EINVAL]           The namelen argument is not a valid length for the
                       address family.

    [ENOTSOCK]         The s argument is a descriptor for a file, not a
                       socket.

    [EADDRNOTAVAIL]    The specified address is not available on this
                       machine.

    [EAFNOSUPPORT]     Addresses in the specified address family cannot be
                       used with this socket.

    [EISCONN]          The socket is already connected.

    [ETIMEDOUT]        Connection establishment timed out without
                       establishing a connection.

    [ECONNREFUSED]     The attempt to connect was forcefully rejected.

    [ECONNRESET]       The connection was reset by the remote host.

    [ENETUNREACH]      The network is not reachable from this host.

    [EHOSTUNREACH]     The remote host is not reachable from this host.

    [EADDRINUSE]       The address is already in use.

    [EFAULT]           The name argument specifies an area outside the
                       process address space.

    [EINPROGRESS]      The socket is non-blocking and the connection cannot
                       be completed immediately.  It is possible to select(2)
                       for completion by selecting the socket for writing.

    [EINTR]            The connection attempt was interrupted by the delivery
                       of a signal.  The connection will be established in
                       the background, as in the case of EINPROGRESS.

    [EALREADY]         A previous connection attempt has not yet been
                       completed.

    [EACCES]           An attempt is made to connect to a broadcast address
                       (obtained through the INADDR_BROADCAST constant or the
                       INADDR_NONE return value) through a socket that does
                       not provide broadcast functionality.

    [EAGAIN]           An auto-assigned port number was requested but no
                       auto-assigned ports are available.  Increasing the
                       port range specified by sysctl(3) MIB variables
                       net.inet.ip.portrange.first and
                       net.inet.ip.portrange.last may alleviate the problem.

    The following errors are specific to connecting names in the UNIX domain.
    These errors may not apply in future versions of the UNIX IPC domain.

    [ENOTDIR]          A component of the path prefix is not a directory.

    [ENAMETOOLONG]     A component of a pathname exceeded 255 characters, or
                       an entire path name exceeded 1023 characters.

    [ENOENT]           The named socket does not exist.

    [EACCES]           Search permission is denied for a component of the
                       path prefix.

    [EACCES]           Write access to the named socket is denied.

    [ELOOP]            Too many symbolic links were encountered in
                       translating the pathname.

    [EPERM]            Write access to the named socket is denied.
а теперь глянь ещё на read. И вот в нём есть EINVAL, который, на прикладном уровне, может быть чем угодно.
источник

VO

Vyacheslav Olkhovche... in Modern::Perl
allter
а теперь глянь ещё на read. И вот в нём есть EINVAL, который, на прикладном уровне, может быть чем угодно.
[EINVAL]           The pointer associated with fd was negative.
источник

VG

Vadim Goncharov in Modern::Perl
allter
а теперь глянь ещё на read. И вот в нём есть EINVAL, который, на прикладном уровне, может быть чем угодно.
ERRORS
    The read(), readv(), pread() and preadv() system calls will succeed
    unless:

    [EBADF]            The fd argument is not a valid file or socket
                       descriptor open for reading.

    [ECONNRESET]       The fd argument refers to a socket, and the remote
                       socket end is forcibly closed.

    [EFAULT]           The buf argument points outside the allocated address
                       space.

    [EIO]              An I/O error occurred while reading from the file
                       system.

    [EBUSY]            Failed to read from a file, e.g. /proc/<pid>/regs
                       while <pid> is not stopped

    [EINTR]            A read from a slow device (i.e. one that might block
                       for an arbitrary amount of time) was interrupted by
                       the delivery of a signal before any data arrived.

    [EINVAL]           The pointer associated with fd was negative.

    [EAGAIN]           The file was marked for non-blocking I/O, and no data
                       were ready to be read.

    [EISDIR]           The file descriptor is associated with a directory
                       residing on a file system that does not allow regular
                       read operations on directories (e.g. NFS).

    [EOPNOTSUPP]       The file descriptor is associated with a file system
                       and file type that do not allow regular read
                       operations on it.

    [EOVERFLOW]        The file descriptor is associated with a regular file,
                       nbytes is greater than 0, offset is before the end-of-
                       file, and offset is greater than or equal to the
                       offset maximum established for this file system.

    [EINVAL]           The value nbytes is greater than INT_MAX.

    In addition, readv() and preadv() may return one of the following errors:

    [EINVAL]           The iovcnt argument was less than or equal to 0, or
                       greater than IOV_MAX.

    [EINVAL]           One of the iov_len values in the iov array was
                       negative.

    [EINVAL]           The sum of the iov_len values in the iov array
                       overflowed a 32-bit integer.

    [EFAULT]           Part of the iov array points outside the process's
                       allocated address space.

    The pread() and preadv() system calls may also return the following
    errors:

    [EINVAL]           The offset value was negative.

    [ESPIPE]           The file descriptor is associated with a pipe, socket,
                       or FIFO.
источник

VG

Vadim Goncharov in Modern::Perl
allter
а теперь глянь ещё на read. И вот в нём есть EINVAL, который, на прикладном уровне, может быть чем угодно.
каким "чем угодно" ? пять вариантов из 18, и то часть из них не для самого read()
источник

VG

Vadim Goncharov in Modern::Perl
Vyacheslav Olkhovchenkov
[EINVAL]           The pointer associated with fd was negative.
причем этот вариант не для сокетов, кстати
источник

VO

Vyacheslav Olkhovche... in Modern::Perl
[EINVAL]           The value nbytes is greater than INT_MAX.
источник

VO

Vyacheslav Olkhovche... in Modern::Perl
в общем-то с tcp тут всё хорошо
источник

VO

Vyacheslav Olkhovche... in Modern::Perl
вот с голубым зубом пизда, да
источник

VO

Vyacheslav Olkhovche... in Modern::Perl
по крайне мере в лялихе
источник

a

allter in Modern::Perl
Ладно, если вы умеете работать с tcp безопасно, то я рад за вас.
Но вот я лучше буду считать, что, его правильное использование очень сложно, учитывая, что пакеты идут распределённо и независимо. И буду обрабатывать задачу консенсуса пиров относительно статуса передачи отдельно.
Вспоминается, что кто-то пытался реализовать tcp "по докам" (без учёта таймаутов и прочего конкретных реализаций) - и ничего у него в итоге не заработало.

С данной темой я заканчиваю, ибо это (POSIX/linux потроха) всё же офтопик.
источник

VG

Vadim Goncharov in Modern::Perl
allter
Ладно, если вы умеете работать с tcp безопасно, то я рад за вас.
Но вот я лучше буду считать, что, его правильное использование очень сложно, учитывая, что пакеты идут распределённо и независимо. И буду обрабатывать задачу консенсуса пиров относительно статуса передачи отдельно.
Вспоминается, что кто-то пытался реализовать tcp "по докам" (без учёта таймаутов и прочего конкретных реализаций) - и ничего у него в итоге не заработало.

С данной темой я заканчиваю, ибо это (POSIX/linux потроха) всё же офтопик.
да где независимо-то? сокет тебя изолирует от этого
источник

VG

Vadim Goncharov in Modern::Perl
будь оно так, людям бы на HTTP-запрос страница приходила кусками в каком попало порядке =)
источник

a

allter in Modern::Perl
Vadim Goncharov
да где независимо-то? сокет тебя изолирует от этого
Ты получил какую-то ошибку на read. Можешь ли ты считать, что обработка удалённой стороной завершена? В какой момент ты сможешь это считать? Можно ли ускорить этот момент?
источник

VG

Vadim Goncharov in Modern::Perl
allter
Ты получил какую-то ошибку на read. Можешь ли ты считать, что обработка удалённой стороной завершена? В какой момент ты сможешь это считать? Можно ли ускорить этот момент?
что такое "обработка" ?
источник

VO

Vyacheslav Olkhovche... in Modern::Perl
это все аюсолютно независимые моменты.
источник

VG

Vadim Goncharov in Modern::Perl
tcp предоставляет тебе абстракцию - поток байт
источник

VO

Vyacheslav Olkhovche... in Modern::Perl
а ошибку на read получил 503
источник

VG

Vadim Goncharov in Modern::Perl
избавляя от кучи геморроя с собственно сетевым уровнем
источник