Networking Forums

Networking Forums > Computer Networking > Linux Networking > Change of parameters of the WORKING SOCKET

Reply
Thread Tools Display Modes

Change of parameters of the WORKING SOCKET

 
 
Pavel Vasilyev
Guest
Posts: n/a

 
      06-22-2007, 05:55 PM
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.

 
Reply With Quote
 
 
 
 
Bin Chen
Guest
Posts: n/a

 
      06-23-2007, 12:15 AM
On Jun 23, 1:55 am, Pavel Vasilyev <l...@nextmail.ru> 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);
}

 
Reply With Quote
 
Pavel Vasilyev
Guest
Posts: n/a

 
      06-23-2007, 06:31 AM
On 23 , 04:15, Bin Chen <binary.c...@gmail.com> wrote:
> On Jun 23, 1:55 am, Pavel Vasilyev <l...@nextmail.ru> 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 ?

 
Reply With Quote
 
Bin Chen
Guest
Posts: n/a

 
      06-23-2007, 06:45 AM
On Jun 23, 2:31 pm, Pavel Vasilyev <l...@nextmail.ru> wrote:
> On 23 , 04:15, Bin Chen <binary.c...@gmail.com> wrote:
>
>
>
> > On Jun 23, 1:55 am, Pavel Vasilyev <l...@nextmail.ru> 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.

 
Reply With Quote
 
Pavel Vasilyev
Guest
Posts: n/a

 
      06-23-2007, 10:05 PM
On 23 , 10:45, Bin Chen <binary.c...@gmail.com> 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)

 
Reply With Quote
 
Pavel Vasilyev
Guest
Posts: n/a

 
      06-24-2007, 12:19 AM
On 23 , 10:45, Bin Chen <binary.c...@gmail.com> wrote:
> On Jun 23, 2:31 pm, Pavel Vasilyev <l...@nextmail.ru> wrote:
> > On 23 , 04:15, Bin Chen <binary.c...@gmail.com> wrote:
> > > On Jun 23, 1:55 am, Pavel Vasilyev <l...@nextmail.ru> 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)

..

 
Reply With Quote
 
Pavel Vasilyev
Guest
Posts: n/a

 
      06-24-2007, 12:20 AM
On 23 , 10:45, Bin Chen <binary.c...@gmail.com> wrote:
> On Jun 23, 2:31 pm, Pavel Vasilyev <l...@nextmail.ru> wrote:
> > On 23 , 04:15, Bin Chen <binary.c...@gmail.com> wrote:
> > > On Jun 23, 1:55 am, Pavel Vasilyev <l...@nextmail.ru> 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)

..

 
Reply With Quote
 
Pavel Vasilyev
Guest
Posts: n/a

 
      06-24-2007, 12:20 AM
On 23 , 10:45, Bin Chen <binary.c...@gmail.com> wrote:
> On Jun 23, 2:31 pm, Pavel Vasilyev <l...@nextmail.ru> wrote:
> > On 23 , 04:15, Bin Chen <binary.c...@gmail.com> wrote:
> > > On Jun 23, 1:55 am, Pavel Vasilyev <l...@nextmail.ru> 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)

..

 
Reply With Quote
 
David Schwartz
Guest
Posts: n/a

 
      06-25-2007, 09:33 PM
On Jun 23, 5:19 pm, Pavel Vasilyev <l...@nextmail.ru> 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

 
Reply With Quote
 
Pavel Vasilyev
Guest
Posts: n/a

 
      07-03-2007, 09:34 PM

David Schwartz:
> On Jun 23, 5:19 pm, Pavel Vasilyev <l...@nextmail.ru> 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 With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Test socket on Master Socket not working Kevin Cowans Broadband 14 11-15-2006 09:17 PM
How to determine is socket in working state Alexander Krizhanovsky Linux Networking 0 06-27-2006 02:39 PM
Wireless WEP password change not working Denny Sharpe Wireless Networks 1 11-21-2005 03:08 AM
netbios name no longer working after IP address change gkelly Windows Networking 2 01-11-2005 10:25 PM
netlink socket to receive route updates not working??? Deepak Linux Networking 0 09-29-2003 09:40 AM



1 2 3 4 5 6 7 8 9 10 11