In several Winsock programs, I see that a loop with
n = select(max_sock, &read_fd, &write_fd, &except_fd, &timeval);
operation on a non-blocking socket takes approx. 2 seconds to determine there is no
listener for that socket. Even for a localhost:55117 operation.
I have no listening program on port 55117. And I'd expect this to be faster.
Even with curl that's bundled with Windows, I see this:
c:\> curl -4 localhost:55117
curl: (7) Failed to connect to localhost port 55117 after 2055 ms: Connection refused
Because there is no way to determine there is no listener unless you wait an appropriate amount of time for the server you tried to connect to to respond. If you waited one millisecond and the server you're connecting to doesn't respond to the connection request for 500 milliseconds, your code just assumed there was no response, and therefore no listener on the other end. In reality, your code was impatient and didn't wait long enough for the response to the connection request.
It's part of the Connection to the socket. The timeout you're specifying is for data transfer and query once the connection is setup. It has nothing to do with the time it takes to setup the connection itself.
TIMEVAL is combination of seconds and microseconds; there is no explicit millisecond setting for TIMEVAL.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
The usual dumb question from me... and I apologize for being this way. But I see as a trend here in CP project Articles' posters' run up to publishing ... tag lack, beyond the general Visual Studio. It's easy to browse the code; yes. Read the Format version, the actual VS "#" and then there's the "VisualStudioVersion".
I suppose I want to head off the "This project created with a newer version of Visual Studio" warning. But that "MinimumVisualStudioVersion" has always had me baffled as when I open a newer project that, if the "minimum" were indeed something to Visual Studio, my VS, which passes muster according to this spec, never seems to be able to do much in the way of filling out the Browser tree beyond the next message "fail to load project" (sp).
Short of suggesting I subscribe to the latest VS incarnation, are there any acceptable apologies for for this descriptive non sense from MS then?
Why has Binding never caught on in Windows Forms. I have been using binding in Wpf for years. Have not paid much attention to Windows Forms. Someone just pointed out that Windows Forms has binding. Looking it up they have had it since .Net2. Occasionally I have had to maintain a Windows Forms app and have never seen it used.
So many years of programming I have forgotten more languages than I know.
If one never leaves the Designer, and believes all the "no code behind", then one never learns about Windows Forms binding, etc. It's when you start writing your own framework(s) and patterns that all this starts to come to the surface. For some, that is a bad thing ("details").
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
That will require creating another table to handle the numbering for your application plus coding to handle the incremented value in that column, well, simply, I don't bind the PK, I handle it manually.
I've come to realize there's no point in binding the autonumber/PK because, at most, it's only used for display. It's not something the user can edit. I display it in a label, using "New" when it's -1.
I've been working with this batch file for a few hours and I can't seem to getthis file to work properly and I can't use PowerShell because my company's network won't allow it so I'm using a batch file. I'm trying to go through a list of machines and I can't seem to get past the first machine. I think I found the issue though but can't seem to get the line fixed to go to the second machine. I think it's after the findstr line after troubleshooting the code line by line.
Here's my code of what I tried.
For /f %%i in (C:\Users\%username%\desktop\computers.txt) do (
echo %DATE% %TIME%
ping %%i /n 1 | find "Reply from %%i:"
if errorlevel 0 echo The computer is online and on VPN
if errorlevel 1 echo The computer is offline or not on VPN
if errorlevel 1 goto skip
REG QUERY "\\%%i\regpath" | findstr "Computer"
query user /server:%%i
dir /T:W "\\%%i\C$\path\file.exe" | find "exe"
(findstr /i /l "configurationserver=https://URL" \\%%i\C$\path\file.ini > NUL && (goto skip) || goto fixfile)
echo pfile.ini isn't good
code to fix issue
echo file is good
""for testing purposes the computers.txt has two computer IP Addresses
I've tried errorlevel for the findstr and also the second solution within the code.
It's impossible to test your script, but I will say if FINDSTR finds the string in the file, ERRORLEVEL will be 0. If not found, or the file does not exist, ERRORLEVEL will be 1.
When you check for ERRORLEVEL in a block of IF statements, you have to check for the highest possible errorlevel value first and check for 0 last. This is because the IF ERRORLEVEL will return true if ERRORLEVEL is greater than or equal to the specified value. So if you check for 0 first, the result will always be true, no matter what the value of ERRORLEVEL is.
Remove the ECHO's from your IF statements and just jump to a block that contains the ECHO statements and what to do after that. This will eliminate the need for multiple IF statements checking for the same ERRORLEVEL.