Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Example network program doesn't work on school network  (Read 12521 times)

0 Members and 1 Guest are viewing this topic.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Example network program doesn't work on school network
« Reply #15 on: October 22, 2013, 10:14:08 pm »
try to run the app with admin privileges
iride already mentioned how presumably uncooperative the administrators are. So this is not really an option. Also, I don't know how Microsoft handles permission errors or "access denied" errors, but from MSDN documentation it seems the only close match, WSAEACCES, is only returned when trying to access already created sockets, so I can only assume this really is a permission problem.

iride, what output does this code produce?
#pragma comment( lib, "Ws2_32.lib" )

#include <iostream>
#include <winsock2.h>

int main() {
        int error = 0;

        WSADATA data;
        error = WSAStartup( MAKEWORD( 2, 2 ), &data );

        if( error ) {
                std::cout << "WSAStartup() failed: " << error << "\n";
                return -1;
        }

        SOCKET s = WSASocket( AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0 );

        if( s == INVALID_SOCKET ) {
                std::cout << "IPv4 socket() failed: " << WSAGetLastError() << "\n";

                s = WSASocket( AF_INET6, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0 );

                if( s == INVALID_SOCKET ) {
                        std::cout << "IPv6 socket() failed: " << WSAGetLastError() << "\n";
                        return -1;
                }
        }

        error = closesocket( s );

        if( error == SOCKET_ERROR ) {
                std::cout << "closesocket() failed: " << WSAGetLastError() << "\n";
                return -1;
        }

        error = WSACleanup();

        if( error == SOCKET_ERROR ) {
                std::cout << "WSACleanup() failed: " << WSAGetLastError() << "\n";
                return -1;
        }

        std::cout << "Everything completed successfully.\n";

        return 0;
}
« Last Edit: October 22, 2013, 10:17:06 pm by binary1248 »
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Example network program doesn't work on school network
« Reply #16 on: October 23, 2013, 05:12:24 pm »
IPv4 socket() failed: 10022
IPv6 socket() failed: 10022

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Example network program doesn't work on school network
« Reply #17 on: October 23, 2013, 09:47:53 pm »
This is probably a permission problem... can you use any other network program that isn't installed on the local machine? Or do they also fail to connect?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Example network program doesn't work on school network
« Reply #18 on: October 23, 2013, 10:13:22 pm »
This is probably a permission problem... can you use any other network program that isn't installed on the local machine? Or do they also fail to connect?
I downloaded Google Chrome and it works fine.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Example network program doesn't work on school network
« Reply #19 on: October 24, 2013, 03:09:16 am »
I downloaded Google Chrome and it works fine.
Just so there is no ambiguity, you downloaded Google Chrome, installed it, and ran it and it can load web pages properly? I looked at the Chrome source code and they use the same functions as in the code snippets I already posted.

Can you try to download something "smaller" and that doesn't require an install. Something that can run by itself right from the .exe at the location you downloaded it to. I attached a test program I had lying around so you can see if it downloads the HTTP source of the website it tries to connect to.

You could also try going for broke and installing Code::Blocks and testing from there. If the headers that came with Visual Studio are really screwed up then there is nothing else you can do with it.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Example network program doesn't work on school network
« Reply #20 on: October 24, 2013, 01:11:59 pm »
Do you actually know which kind of antivirus/firewall is running on the PCs? I remember the Comodo Firewall causing rather weird API behavior, even while being deactivated (like crashing QT programs just because they tried to create a socket).

Also wouldn't consider Chrome being some reliable test, because most firewalls will most likely let it pass based on their own whitelists.

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Example network program doesn't work on school network
« Reply #21 on: October 24, 2013, 06:00:07 pm »
Do you actually know which kind of antivirus/firewall is running on the PCs? I remember the Comodo Firewall causing rather weird API behavior, even while being deactivated (like crashing QT programs just because they tried to create a socket).

Also wouldn't consider Chrome being some reliable test, because most firewalls will most likely let it pass based on their own whitelists.
McAfee

This is probably a permission problem... can you use any other network program that isn't installed on the local machine? Or do they also fail to connect?
I downloaded Google Chrome and it works fine.

I can't confirm if your program is working because it closes to fast before I can see the output. I can't even run the  program from command prompt because it's disabled. Howerver, I tried running an old chat program that I made with SFML 2.0 and strangely, it works.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Example network program doesn't work on school network
« Reply #22 on: October 24, 2013, 06:26:55 pm »
I can't even run the  program from command prompt because it's disabled.
Sounds like a fun time... My program should have spit out a fairly long HTML document on the console, so if it closes that fast, it probably means it failed somewhere. Try to run it from the "Run" menu in Windows (Windows key + R) and output the output to some file with:
Code: [Select]
HelloWorld.exe > output.txtMaybe that will work.

Howerver, I tried running an old chat program that I made with SFML 2.0 and strangely, it works.
Try other settings and IDEs. Maybe static linking works, maybe Code::Blocks/MinGW works. We really shouldn't try understand how Microsoft implemented it's winsock API/security/DLLs and just trial and error until we find something that works.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Example network program doesn't work on school network
« Reply #23 on: October 24, 2013, 08:28:47 pm »
wait...  I got it to work now.

If the exectuable is located in a clouded drive, it doesn't work...
But if the  executable is in a computer's local drive(C: for example), everything suddenly works!
Appreciate the help anyways. Thanks :)

 

anything