Change of parameters of the WORKING SOCKET - Networking

This is a discussion on Change of parameters of the WORKING SOCKET - Networking ; Whether will probably establish options of a socket already on existing connection? for example: #lsof -i | grep ESTABLISHED ... firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226- >mg-in-f147.google.com:http (ESTABLISHED) .... It is necessary to establish, for example, on this ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: Change of parameters of the WORKING SOCKET

  1. Change of parameters of the WORKING SOCKET

    Whether will probably establish options of a socket already on
    existing connection?

    for example:

    #lsof -i | grep ESTABLISHED
    ...
    firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226-
    >mg-in-f147.google.com:http (ESTABLISHED)

    ....

    It is necessary to establish, for example, on this socket option
    O_NONBLOCK or O_NODELAY.


    Please example code (if exist). Thanks.


  2. Re: Change of parameters of the WORKING SOCKET

    On Jun 23, 1:55 am, Pavel Vasilyev wrote:
    > Whether will probably establish options of a socket already on
    > existing connection?
    >
    > for example:
    >
    > #lsof -i | grep ESTABLISHED
    > ...
    > firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226->mg-in-f147.google.com:http (ESTABLISHED)
    >
    > ...
    >
    > It is necessary to establish, for example, on this socket option
    > O_NONBLOCK or O_NODELAY.
    >
    > Please example code (if exist). Thanks.


    static void unset_fl(int fd, int flags) /* flags are file status flags
    to turn on
    */
    {
    int val;

    if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    printf("error on fcntl GETFL",
    1);

    val &= ~flags; /* turn on flags
    */

    if (fcntl(fd, F_SETFL, val) < 0)
    printf("error on fcntl SETFL",
    1);
    }


    static void set_fl(int fd, int flags) /* flags are file status flags
    to turn on
    */
    {
    int val;

    if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    printf("error on fcntl GETFL",
    1);

    val |= flags; /* turn on flags
    */

    if (fcntl(fd, F_SETFL, val) < 0)
    printf("error on fcntl SETFL",
    1);
    }


  3. Re: Change of parameters of the WORKING SOCKET

    On 23 , 04:15, Bin Chen wrote:
    > On Jun 23, 1:55 am, Pavel Vasilyev wrote:
    >
    > > Whether will probably establish options of a socket already on
    > > existing connection?

    >
    > > for example:

    >
    > > #lsof -i | grep ESTABLISHED
    > > ...
    > > firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226->mg-in-f147.google.com:http (ESTABLISHED)

    >
    > > ...

    >
    > > It is necessary to establish, for example, on this socket option
    > > O_NONBLOCK or O_NODELAY.

    >
    > > Please example code (if exist). Thanks.

    >
    > static void unset_fl(int fd, int flags) /* flags are file status flags
    > to turn on
    > */
    > {
    > int val;
    >
    > if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    > printf("error on fcntl GETFL",
    > 1);
    >
    > val &= ~flags; /* turn on flags
    > */
    >
    > if (fcntl(fd, F_SETFL, val) < 0)
    > printf("error on fcntl SETFL",
    > 1);
    >
    > }
    >
    > static void set_fl(int fd, int flags) /* flags are file status flags
    > to turn on
    > */
    > {
    > int val;
    >
    > if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    > printf("error on fcntl GETFL",
    > 1);
    >
    > val |= flags; /* turn on flags
    > */
    >
    > if (fcntl(fd, F_SETFL, val) < 0)
    > printf("error on fcntl SETFL",
    > 1);
    >
    > }


    Heh!, Tanks, But how i connect to fd ?


  4. Re: Change of parameters of the WORKING SOCKET

    On Jun 23, 2:31 pm, Pavel Vasilyev wrote:
    > On 23 , 04:15, Bin Chen wrote:
    >
    >
    >
    > > On Jun 23, 1:55 am, Pavel Vasilyev wrote:

    >
    > > > Whether will probably establish options of a socket already on
    > > > existing connection?

    >
    > > > for example:

    >
    > > > #lsof -i | grep ESTABLISHED
    > > > ...
    > > > firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226->mg-in-f147.google.com:http (ESTABLISHED)

    >
    > > > ...

    >
    > > > It is necessary to establish, for example, on this socket option
    > > > O_NONBLOCK or O_NODELAY.

    >
    > > > Please example code (if exist). Thanks.

    >
    > > static void unset_fl(int fd, int flags) /* flags are file status flags
    > > to turn on
    > > */
    > > {
    > > int val;

    >
    > > if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    > > printf("error on fcntl GETFL",
    > > 1);

    >
    > > val &= ~flags; /* turn on flags
    > > */

    >
    > > if (fcntl(fd, F_SETFL, val) < 0)
    > > printf("error on fcntl SETFL",
    > > 1);

    >
    > > }

    >
    > > static void set_fl(int fd, int flags) /* flags are file status flags
    > > to turn on
    > > */
    > > {
    > > int val;

    >
    > > if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    > > printf("error on fcntl GETFL",
    > > 1);

    >
    > > val |= flags; /* turn on flags
    > > */

    >
    > > if (fcntl(fd, F_SETFL, val) < 0)
    > > printf("error on fcntl SETFL",
    > > 1);

    >
    > > }

    >
    > Heh!, Tanks, But how i connect to fd ?


    You want to operate the socket that others created? That is impossible.


  5. Re: Change of parameters of the WORKING SOCKET

    On 23 , 10:45, Bin Chen wrote:

    >
    > > > if (fcntl(fd, F_SETFL, val) < 0)
    > > > printf("error on fcntl SETFL",
    > > > 1);

    >
    > > > }

    >
    > > Heh!, Tanks, But how i connect to fd ?

    >
    > You want to operate the socket that others created? That is impossible.


    Yes. Why impossible. (i say this my boss)


  6. Re: Change of parameters of the WORKING SOCKET

    On 23 , 10:45, Bin Chen wrote:
    > On Jun 23, 2:31 pm, Pavel Vasilyev wrote:
    > > On 23 , 04:15, Bin Chen wrote:
    > > > On Jun 23, 1:55 am, Pavel Vasilyev wrote:


    > > > > Whether will probably establish options of a socket already on
    > > > > existing connection?
    > > > > for example:
    > > > > #lsof -i | grep ESTABLISHED
    > > > > firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226->mg-in-f147.google.com:http (ESTABLISHED)
    > > > > It is necessary to establish, for example, on this socket option
    > > > > O_NONBLOCK or O_NODELAY.
    > > > > Please example code (if exist). Thanks.
    > > > static void unset_fl(int fd, int flags) /* flags are file status flags
    > > > int val;

    >
    > > > if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    > > > printf("error on fcntl GETFL",

    >
    > > > if (fcntl(fd, F_SETFL, val) < 0)
    > > > printf("error on fcntl SETFL",


    > > Heh!, Tanks, But how i connect to fd ?

    >
    > You want to operate the socket that others created? That is impossible.



    Yes. Why it is impossible. (I shall tell it to my boss)

    ..


  7. Re: Change of parameters of the WORKING SOCKET

    On 23 , 10:45, Bin Chen wrote:
    > On Jun 23, 2:31 pm, Pavel Vasilyev wrote:
    > > On 23 , 04:15, Bin Chen wrote:
    > > > On Jun 23, 1:55 am, Pavel Vasilyev wrote:


    > > > > Whether will probably establish options of a socket already on
    > > > > existing connection?
    > > > > for example:
    > > > > #lsof -i | grep ESTABLISHED
    > > > > firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226->mg-in-f147.google.com:http (ESTABLISHED)
    > > > > It is necessary to establish, for example, on this socket option
    > > > > O_NONBLOCK or O_NODELAY.
    > > > > Please example code (if exist). Thanks.
    > > > static void unset_fl(int fd, int flags) /* flags are file status flags
    > > > int val;

    >
    > > > if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    > > > printf("error on fcntl GETFL",

    >
    > > > if (fcntl(fd, F_SETFL, val) < 0)
    > > > printf("error on fcntl SETFL",


    > > Heh!, Tanks, But how i connect to fd ?

    >
    > You want to operate the socket that others created? That is impossible.



    Yes. Why it is impossible. (I shall tell it to my boss)

    ..


  8. Re: Change of parameters of the WORKING SOCKET

    On 23 , 10:45, Bin Chen wrote:
    > On Jun 23, 2:31 pm, Pavel Vasilyev wrote:
    > > On 23 , 04:15, Bin Chen wrote:
    > > > On Jun 23, 1:55 am, Pavel Vasilyev wrote:


    > > > > Whether will probably establish options of a socket already on
    > > > > existing connection?
    > > > > for example:
    > > > > #lsof -i | grep ESTABLISHED
    > > > > firefox-b 5026 pavel 36u IPv4 17468 TCP 192.168.1.10:9226->mg-in-f147.google.com:http (ESTABLISHED)
    > > > > It is necessary to establish, for example, on this socket option
    > > > > O_NONBLOCK or O_NODELAY.
    > > > > Please example code (if exist). Thanks.
    > > > static void unset_fl(int fd, int flags) /* flags are file status flags
    > > > int val;

    >
    > > > if ((val = fcntl(fd, F_GETFL, 0)) < 0)
    > > > printf("error on fcntl GETFL",

    >
    > > > if (fcntl(fd, F_SETFL, val) < 0)
    > > > printf("error on fcntl SETFL",


    > > Heh!, Tanks, But how i connect to fd ?

    >
    > You want to operate the socket that others created? That is impossible.



    Yes. Why it is impossible. (I shall tell it to my boss)

    ..


  9. Re: Change of parameters of the WORKING SOCKET

    On Jun 23, 5:19 pm, Pavel Vasilyev wrote:

    > Yes. Why it is impossible. (I shall tell it to my boss)


    If the code was designed to handle a socket in those modes, it would
    have set the socket to those modes. If the code was not designed to
    handle a socket in those modes, it may break if it gets one.

    What are you actually trying to do? Why would you want to change the
    blocking or Nagle state of another process' connections?!

    DS


  10. Re: Change of parameters of the WORKING SOCKET


    David Schwartz:
    > On Jun 23, 5:19 pm, Pavel Vasilyev wrote:
    >
    > > Yes. Why it is impossible. (I shall tell it to my boss)

    >
    > If the code was designed to handle a socket in those modes, it would
    > have set the socket to those modes. If the code was not designed to
    > handle a socket in those modes, it may break if it gets one.
    >
    > What are you actually trying to do? Why would you want to change the
    > blocking or Nagle state of another process' connections?!
    >

    Yes, need set/unset O_NODELAY option on working connection!


+ Reply to Thread