Establish SFTP connection

Hi ,

I am trying to connect to a SFTP server on my machine running using
WinSSHD. The port on which it is running is 22. I am unable to make a
connection to this port using ruby Net:sftp and Net:SSH libraries.
Here are both the codes:

#Option 1
require ‘net/sftp’
Net::SFTP.start(‘’,:port =>22,:user=> ‘sri’, :password =>
‘root’) do |sftp|
sftp.upload!(“c:\u.txt”, “/”)


#option 2
require ‘net/ssh’
require ‘net/sftp’

(‘’,:password=>‘root’,:port=>22,:username=>‘sri’) do |ssh|
ssh.sftp.connect do |sftp|
Dir.foreach(’.’) do |file|
puts file

In both above examples i see that connection is taking place at random
ports instead of 22. Is something wrong with the code. Why it is not
taking the port i have specified??

Pls help