TCP socket connection from ASP page

Discussion in 'ASP General' started by User Groups, Jul 17, 2008.

  1. User Groups

    User Groups Guest

    I want to have an asp page that can connect to a TCP listener and send some
    data to it.
    I have done some coding and was able to send data to the listener but for
    one time only.
    As soon as a transmission is over a status of the listener goes into
    close_wait and at the next page submit it's not getting connected to it
    anymore.
    How can I get connected to the listener avery time a page is submitted?

    Thanks for help.
     
    User Groups, Jul 17, 2008
    #1
    1. Advertising

  2. User Groups

    Old Pedant Guest

    What component are you using to make the connection??

    And are you saying you need the connection to persist from page hit to page
    hit for the same session? Or from page hit to page hit for all users in all
    sessions?

    *POSSIBLY* you could store the component object in a Session or Application
    variable. How bad that is depends on how well implemented your ActiveX
    object is. If it is apartment threaded, it will prove to be a bottleneck,
    especially in a heavily loaded system. If it is free threaded, it might work
    just fine.

    Expecting a TCP connection to survive between page hits...which might occur
    15 or 20 minutes apart...may not be the best strategy in any case. Maybe you
    really should set up the connection and tear it down each time. Or maybe you
    should consider a different implementation altogether (e.g., a Web Service?).
     
    Old Pedant, Jul 17, 2008
    #2
    1. Advertising

  3. User Groups

    User Groups Guest

    Let's focus on one session/one user.
    I dont want aconnection to survive at all. I want to connect to a listner
    from asp page
    on every hit, send data to it (listener), and that's all.

    "Old Pedant" <> wrote in message
    news:...
    > What component are you using to make the connection??
    >
    > And are you saying you need the connection to persist from page hit to
    > page
    > hit for the same session? Or from page hit to page hit for all users in
    > all
    > sessions?
    >
    > *POSSIBLY* you could store the component object in a Session or
    > Application
    > variable. How bad that is depends on how well implemented your ActiveX
    > object is. If it is apartment threaded, it will prove to be a bottleneck,
    > especially in a heavily loaded system. If it is free threaded, it might
    > work
    > just fine.
    >
    > Expecting a TCP connection to survive between page hits...which might
    > occur
    > 15 or 20 minutes apart...may not be the best strategy in any case. Maybe
    > you
    > really should set up the connection and tear it down each time. Or maybe
    > you
    > should consider a different implementation altogether (e.g., a Web
    > Service?).
    >
    >
     
    User Groups, Jul 17, 2008
    #3
  4. User Groups

    Old Pedant Guest

    Okay, that sounds good.

    So why isn't that working now??? Are you saying that you are unable to make
    a second connection to the same socket? Possibly because the first
    connection never go closed?

    And you didn't say what component you are using to do this with. Is it a
    commercial one or did you roll your own?

    There used to be a pretty generic sockets component from ServerObjects.com
    but they seem to have withdrawn it. Only ones I find are these:
    http://www.aspin.com/home/components/internet/winsockf
     
    Old Pedant, Jul 17, 2008
    #4
  5. User Groups

    User Groups Guest

    <Are you saying that you are unable to make
    < a second connection to the same socket
    Exactly. Because the listener goes into close_wait and no connection can be
    done to it.
    I am using Winsock ActiveX control.


    "Old Pedant" <> wrote in message
    news:...
    > Okay, that sounds good.
    >
    > So why isn't that working now??? Are you saying that you are unable to
    > make
    > a second connection to the same socket? Possibly because the first
    > connection never go closed?
    >
    > And you didn't say what component you are using to do this with. Is it a
    > commercial one or did you roll your own?
    >
    > There used to be a pretty generic sockets component from ServerObjects.com
    > but they seem to have withdrawn it. Only ones I find are these:
    > http://www.aspin.com/home/components/internet/winsockf
    >
     
    User Groups, Jul 17, 2008
    #5
  6. User Groups

    Old Pedant Guest

    > Exactly. Because the listener goes into close_wait and no connection can be
    > done to it.
    > I am using Winsock ActiveX control.


    Gotcha. Sorry. Never used this. You'd think it would work, being from MS,
    but....

    I'm *assuming* it goes into close_wait when you attempt to close the
    connection, no? Or do you mean it does so before you attempt the close?
    Ehhh...not that I would know how to fix either condition. Sorry.

    May be time to abandon this control and find another wone to use??
     
    Old Pedant, Jul 17, 2008
    #6
  7. User Groups

    User Groups Guest

    I am not entirely sure it's because of a control I am using.
    I tried to close connection after data has been sent or leave it and let it
    die because of an asp page life cicle. Same.
    "Old Pedant" <> wrote in message
    news:...
    >> Exactly. Because the listener goes into close_wait and no connection can
    >> be
    >> done to it.
    >> I am using Winsock ActiveX control.

    >
    > Gotcha. Sorry. Never used this. You'd think it would work, being from
    > MS,
    > but....
    >
    > I'm *assuming* it goes into close_wait when you attempt to close the
    > connection, no? Or do you mean it does so before you attempt the close?
    > Ehhh...not that I would know how to fix either condition. Sorry.
    >
    > May be time to abandon this control and find another wone to use??
    >
    >
    >
    >
     
    User Groups, Jul 17, 2008
    #7
  8. User Groups

    p byers Guest

    Good Morning
    I am presuming that this technology allows the "Client" to find and go
    directly to the desired IP address rather than being routed via several
    intermediate IP addresses.

    Would someone please have the time, energy and inclination to outline the
    Pro's and Con's of such a Technique ??

    Thanks
    Pete (Northolt UK)

    Old Pedant wrote:

    > Okay, that sounds good.
    >
    > So why isn't that working now??? Are you saying that you are unable to make
    > a second connection to the same socket? Possibly because the first
    > connection never go closed?
    >
    > And you didn't say what component you are using to do this with. Is it a
    > commercial one or did you roll your own?
    >
    > There used to be a pretty generic sockets component from ServerObjects.com
    > but they seem to have withdrawn it. Only ones I find are these:
    > http://www.aspin.com/home/components/internet/winsockf
     
    p byers, Jul 18, 2008
    #8
  9. User Groups

    Evertjan. Guest

    p byers wrote on 18 jul 2008 in microsoft.public.inetserver.asp.general:
    > Old Pedant wrote:
    >
    >> Okay, that sounds good.
    >>
    >> So why isn't that working now??? Are you saying that you are unable
    >> to make a second connection to the same socket? Possibly because the
    >> first connection never go closed?
    >>
    >> And you didn't say what component you are using to do this with. Is
    >> it a commercial one or did you roll your own?


    Could you answer that?

    >> There used to be a pretty generic sockets component from
    >> ServerObjects.com but they seem to have withdrawn it. Only ones I
    >> find are these:
    >> http://www.aspin.com/home/components/internet/winsockf


    [Please do not toppost on usenet]

    > I am presuming that this technology allows the "Client" to find
    > and go
    > directly to the desired IP address rather than being routed via
    > several intermediate IP addresses.
    >
    > Would someone please have the time, energy and inclination to
    > outline the Pro's and Con's of such a Technique ??


    Seems far off topic for ASP.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jul 18, 2008
    #9
  10. User Groups

    Old Pedant Guest

    re: TCP socket connection from ASP

    >>> And you didn't say what component you are using to do this with. Is
    >>> it a commercial one or did you roll your own?


    > Could you answer that?


    He did answer it. He wrote:
    "I am using Winsock ActiveX control."

    That's a control that comes with MS Office. It's a pretty generic one, as I
    read the docs, and requires that the scripter do all the steps himself. The
    other commercial ones seem to do a better job of automating the process.
    Still, I can't see why the connection would just "hang".

    p.s.: You should have explained what "toppost" means. I doubt that many
    people use the term any more. Been *years* since I saw it, in fact.
     
    Old Pedant, Jul 18, 2008
    #10
  11. User Groups

    Evertjan. Guest

    re: TCP socket connection from ASP

    =?Utf-8?B?T2xkIFBlZGFudA==?= wrote on 18 jul 2008 in
    microsoft.public.inetserver.asp.general:

    >>>> And you didn't say what component you are using to do this with. Is
    >>>> it a commercial one or did you roll your own?

    >
    >> Could you answer that?

    >
    > He did answer it. He wrote:
    > "I am using Winsock ActiveX control."


    Do you use that on the server in ASP?

    > That's a control that comes with MS Office. It's a pretty generic
    > one, as I read the docs, and requires that the scripter do all the
    > steps himself. The other commercial ones seem to do a better job of
    > automating the process. Still, I can't see why the connection would
    > just "hang".


    In ASP?

    > p.s.: You should have explained what "toppost" means.


    No I should not.
    It is in the Netiquestte files of usenet all over the web.
    And you seem to undeerstand well.

    > I doubt that many people use the term any more.
    > Been *years* since I saw it, in fact.


    You are free to doubt,
    but it is used often in this and manuy other NGs.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jul 18, 2008
    #11
  12. User Groups

    Old Pedant Guest

    re: TCP socket connection from ASP

    "Evertjan." wrote:
    > Do you use [Winsock ActiveX control] on the server in ASP?


    Sure. Why not?? It's an ActiveX control, meaning it's scriptable. And it
    doesn't imply any graphical/window usage (that is, it wasn't intended to be
    used only in a windowing environment).

    >> That's a control that comes with MS Office. It's a pretty generic
    >> one, as I read the docs, and requires that the scripter do all the
    >> steps himself. The other commercial ones seem to do a better job of
    >> automating the process. Still, I can't see why the connection would
    >> just "hang".


    > In ASP?


    Again, sure. If they are ActiveX controls that don't use windows, then why
    couldn't/wouldn't you use them in ASP. Or were you doubting my last
    sentence? Implying that the "hang" might be an artifact of using the control
    in ASP? If so, that was the point of my suggesting he try some other
    control, just in case there is some aspect of that control that doesn't play
    well with ASP. Again, no idea what it might be, but why not experiment a
    bit? (And with one exception, the list of controls in that URL I pointed him
    to all specifically *claim* to be for use with ASP.)

    > > p.s.: You should have explained what "toppost" means.

    > No I should not.


    Okay, so maybe I'm more tolerant than you are. Which is mildly funny, since
    I've been accused of being a nasty responder in the past. ("Past" including
    day before yesterday. <grin/>) I do agree with you, though. I don't like
    topposting any place. EMail, forums, whatever. It's a royal pain no matter
    where you encounter it.
     
    Old Pedant, Jul 18, 2008
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathryn Bean
    Replies:
    1
    Views:
    684
    John Harrison
    Oct 28, 2004
  2. Tiger
    Replies:
    5
    Views:
    974
    Dave Thompson
    May 1, 2006
  3. Laszlo Nagy
    Replies:
    1
    Views:
    4,857
    Mark Wooding
    Jan 27, 2009
  4. Joe Van Dyk
    Replies:
    3
    Views:
    145
    Adam P. Jenkins
    Jul 6, 2005
  5. Scott Cole
    Replies:
    3
    Views:
    249
    Brian Candler
    Sep 28, 2010
Loading...

Share This Page