c# - System.Net.Sockets.SocketException while using webclient -
this question has answer here:
string uploadpath = "http://10.126.64.230/home/pi/videos/"; webclient webclient = new webclient(); credentialcache cc = new credentialcache(); uri uri = new uri("http://10.126.64.230/pi"); networkcredential nc = new networkcredential(); nc.domain = "root"; nc.username = "pi"; nc.password = "posix"; cc.add( uri, "ntlm", nc); webclient.credentials = cc; //system.text.encoding.ascii.getstring(responsearray); bool cntrl = system.io.file.exists(uploadpath + this.fuplvideo.filename); if (cntrl) { // filename = uploadpath + this.fuplvideo.filename + datetime.now.tostring("yyyy-mm-dd hhmmtt") + ext; // webclient.uploadfile(uploadpath, "post", fullfilepath); } else { webclient.uploadfile(uploadpath, "post", fullfilepath); }
i try send file machine connected lan. try code different versions of domain, got
"system.net.sockets.socketexception no connection because of target machine refused"
error every time. suggest me?
there chance target machine has firewall rule on port accessing. guessing port 80. try telnet remote server , see if connection. if cant connect, must firewall issue
Comments
Post a Comment