Re: ODBC.e : port used by existing connection
- Posted by jacques deschênes <desja at globe?r?tter.net> Oct 14, 2007
- 608 views
jacques deschênes wrote: > > Matt Lewis wrote: > > > > Rad wrote: > > > > > > jacques deschênes wrote: > > > > open cmd.exe and type netstat > netstat.txt > > > > the open netstat.txt in notepad > > > > this will give you all the tcp/ip connections. > > > > > > > > > > Hi Jacques, > > > > > > I would like to get the port number from within my Euphoria application. > > > > You might try using SQLBrowseConnect(): > > <a > > href="http://msdn2.microsoft.com/en-us/library/ms714565.aspx">http://msdn2.microsoft.com/en-us/library/ms714565.aspx</a> > > > > Matt > > Or you can use capture.ew to capture the output of the net stat command: > > }}} <eucode> > include capture.ew -- see rapideuphoria archive > > object handles, line > sequence lines > integer fi > handles = capture_exec("net stat -a -b",CAPTURE_STDOUT)--get all connections > with application name > if atom(handle) then > puts(1,"failed to capture child process\n") > else > fi = handles[siSTDOUT] > lines = {} > line = capture_gets(fi) > while sequence(line) do > lines = append(lines,line) > line = capture_gets(fi) > end while > capture_terminate() > > end if > -- now you can filter lines to get needed information > </eucode> {{{ > > regards, > Jacques d. whoops! posted without testing the code. replace "net stat -a -b" by "netstat -a -b" replace if atom(handle) by if atom(handles) jacques d.