Re: ODBC.e : port used by existing connection

new topic     » goto parent     » topic index » view thread      » older message » newer message

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.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu