Avira Antivirus detects the listen function as backdoor model
The function
listen( ListenSocket, SOMAXCONN )
is detected by avira antivirus as a backdoor model.
How can I write small client/开发者_JAVA百科server applications without a listen function?
Is there a way to do it?
If you need to accept connections then no, you can't do that without calling listen.
If you can make your application just a client and have an server running somewhere else then your client can connect to the server and the server can act as a broker for other clients to connect to...
I wouldn't worry about this anyway. If you're running a server that you want to be able to connect to from a machine other than the one it's running on then your documentation will have to explain how to open up firewall ports and whatever so just add details of how to exclude the app from the antivirus applications that it confuses.
Also, your application IS accepting connections from external sources and so the antivirus app is correct to warn the user. You need to educate the user that it's OK for your app to do this because it's doing it for whatever valid reason you have. If you don't want to explain it to the user then, IMHO, you are writing a backdoor ;)
Uninstall Avira Antivirus ;-)
Server, by definition, listens for incoming connections, and clients initiate connections to the server. In TCP/IP networking, the server achieves this by bind()
ing and listen()
ing to a socket.
Avira is filled with all sorts of false-positives that are trivially easy to work around. Try storing listen into a function pointer and calling it. It'll probably work.
If you're dealing with TCP connections and you know who/where the connection is coming from, and have a third party that can tell you when the connection is going to be attempted, it's valid for both sides to connect
to each other at the same time. Doing this can negotiate a connection without either side listening. It's not a good solution and needs a much more complex implementation if a NAT is involved, but it is a possibility if the client and server are on a LAN.
精彩评论