Re: ODBC.e : port used by existing connection
- Posted by jacques deschĂȘnes <desja at globetrot?er?net> Oct 14, 2007
- 625 views
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:
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
regards, Jacques d.