Im testing the async client/server example on MSDN. It works fine. The server example , and the client example   I'm trying to check if I can add some custom server "version" tag. So the client need to specify the version number in order to get a valid connection. It's not the default TCP Three Way Handshake I need. It's a extra custom version number added on the server and specified in the connection string on the client I am looking for.  Can I add some "version" object to the socket?  // Establish the remote endpoint for the socket.   // The name of the remote device is "host.contoso.com".   IPHostEntry ipHostInfo = Dns.GetHostEntry("localhost"); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);  // Create a TCP/IP socket.   Socket client = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);  // Connect to the remote endpoint.   // TODO: How to add custom version object? client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), client);
124094
I am trying to gain a better understanding of tcp/ip sockets in c#, as i want to challenge myself to see if i can create a working MMO infrastructure (game world, map, players, etc) purely for educational purposes as i have no intention of being another one of those "OMGZ iz gonna make my r0x0r MMORPG that will be better than WoW!!!", you know what im talking about.  Anyway, i was wondering if anyone can shed some light as to how one might approach designing this kind of system and what kinds of things are required, and what i should watch out for?  My initial idea was to break up the system into seperate client/server connections with each connection (on its own port) performing a specific task, such as updating player/monster positions, sending and receiving chat messages, etc. which to me would make processing the data easier because you wouldn't always need to put a header on the data to know what information the packet contains.   Does that make sense and is useful or am i just way over complicating things?  your responses are very much appreciated.
8841
This is a  about Hairpin NAT (Loopback NAT).   The generic form of this question is:  We have a network with clients, a server, and a NAT Router. There is port forwarding on the router to the server so some of it's services are available externally. We have DNS pointing to the external IP. Local network clients fail to connect, but external work.   Why does this fail? How can I create a unified naming scheme (DNS names which work both locally and externally)?   This question has answeres merged from multiple other questions. They originally referenced FreeBSD, D-Link, Microtik, and other equipment. They're all trying to solve the same problem however.
65898
Will preface this by saying I am not at all convinced yet this is not the vendor doing something wrong on their application server.  Just looking for new ideas  Instance X is a named instance of SQL Server 2008 R2.  It houses numerous databases and takes in connections from numerous application servers.  Browser service is running and all connections are made by way of server\instance name.  Moved DB from an old 2K5 instance over to it the other day and vendor claims he cannot connect to the DB.  He says he is just putting in the Server\instance name in his connection string and his connection fails. At this time he cannot/has not provided me with any real error message.  Whenever he tries, we see no evidence of success or failure.  As of right now there is no evidence he is even hitting the named instance.  He can hit a test 2008 R2 default instance though.  So, since the named instance appears to be the difference, I am thinking this has something to do with the port number.  We have not explicitly tried the port number because we need it to work with just the name and vendor swears it should.  However, we can connect with his credentials, via SQLCMD and by setting up a basic ODBC.  Application server is 2003R2 and in my opinion, craped up, but replacing it is not an option.  DBNETLIB.DLL version is 2000.86.3959.0 and native client version is 2005.90.3042.  You would have to go quite a ways back to not be able to hit a named instance.  Am I missing anything overly obvious?  From a customer service perspective would prefer to not just say “Works for everyone else!”.  EDIT 9:44PM Central - Should have noted on original post that the firewall is not on on the application server and we do not filter/block anything internal to the network.
104073
I have a Mikrotik RB2011 router, running RouterOS which connects to the internet via a static IP. In my lan I have two different servers, one that is on IP 192.168.89.11 and another on 192.168.89.12  My DNS (on cloudflare) resolves both myfirstserver.com and mysecondserver.com to my router's static IP.  Now, what I want to do is to somehow separate the traffic so all traffic for myfirstserver.com goes to 192.168.89.11 and traffic for mysecondserver.com goes to 192.168.89.12 (and both on port 80. I know I could just change ports but if these are servers publicly available, no user would set a different port than 80)  What I have tried so far, is to somehow mark the packets through mangle and then use that mark on NAT to do the proper dst-nat forward.  I try marking packets through either content or Layer 7 protocol regex (they work properly if the action is log. I can see them being logged correctly).  The thing is that after I mark them, it seems that NAT just ignores them and forwards the connection to the server that accepts the non-marked packets.  I think I have mixed up the order of filtering and the chains somehow.  Would someone be able to provide some pointers/assistance on how to accomplish this?  Thanks!  EDIT: My question is very specific, about marking packets in RouterOS on a Mikrotik router and checking the mark in NAT. it is not about whether i need a reverse proxy or whatever. Thanks  EDIT 2: @Cha0s asked my /ip firewall export so here it is:  /ip firewall layer7-protocol add name=haf1a regexp=haf1a  /ip firewall address-list add address=192.168.89.0/24 list=local add address=192.168.88.0/24 list=local add address=www.xxx.yyy.zzz list=local add address=192.168.87.0/24 list=local  /ip firewall filter add chain=input comment="default configuration" protocol=icmp add chain=input comment="default configuration" connection-state=established add chain=input comment="default configuration" connection-state=related add action=drop chain=virus comment="Drop 80 DoS attack" src-address-list=spammer add action=add-src-to-address-list address-list=spammer address-list-timeout=1d chain=input connection-limit=10,32 dst-address-list=!local dst-port=53 protocol=udp add action=drop chain=input dst-port=53 protocol=udp src-address-list=!local add action=add-src-to-address-list address-list=spammer address-list-timeout=1d chain=input connection-limit=30,32 protocol=tcp /ip firewall mangle add action=change-mss chain=forward new-mss=1422 out-interface=all-ppp protocol=tcp tcp-flags=syn tcp-mss=1423-65535  /ip firewall nat add action=masquerade chain=srcnat comment="default configuration" out-interface=ether1-gateway add action=masquerade chain=srcnat out-interface=pppoe-out1 add action=dst-nat chain=dstnat comment="No HAF mark" dst-address=www.xxx.yyy.zzz dst-port=80 packet-mark=!haf1 port="" protocol=tcp src-port="" to-addresses=192.168.89.41 to-ports=80 add action=dst-nat chain=dstnat comment="HAF mark" dst-address=www.xxx.yyy.zzz dst-port=80 packet-mark=haf1 port="" protocol=tcp src-port="" to-addresses=192.168.89.31 to-ports=80   where www.xxx.yyy.zzz is my external ip (static) and 192.168.89.31 and 192.168.89.41 my two servers inside my local network  My goal is to redirect any connections with haf1a in them (eg haf1a.lala.com) to the relevant server (192.168.89.31)
51728
This is my first time setting up a server and I've just installed a SSL cert. I have also made some changes to the iptable to allow access to 443. Below is the output of iptables -L   target     prot opt source         destination ACCEPT     all  --  anywhere       anywhere        state RELATED,ESTABLISHED ACCEPT     tcp  --  anywhere       anywhere        state NEW tcp dpt:http ACCEPT     icmp --  anywhere       anywhere ACCEPT     all  --  anywhere       anywhere ACCEPT     tcp  --  anywhere       anywhere        state NEW tcp dpt:ssh ACCEPT     tcp  --  anywhere       anywhere        state NEW tcp dpt:smtp ACCEPT     udp  --  anywhere       anywhere        state NEW udp dpt:smtp ACCEPT     tcp  --  anywhere       anywhere        tcp dpt:urd REJECT     all  --  anywhere       anywhere        reject-with icmp-host-prohibited ACCEPT     tcp  --  anywhere       anywhere        state NEW tcp dpt:https   I also checked nmap by ssh'ing into the server and run nmap from the server itself.  Starting Nmap 5.51 ( http://nmap.org ) at 2016-04-15 15:31 SGT Nmap scan report for &lt;my.domain.ip&gt; Host is up (0.0000050s latency). Not shown: 994 closed ports PORT     STATE SERVICE 22/tcp   open  ssh 25/tcp   open  smtp 80/tcp   open  http 443/tcp  open  https 3005/tcp open  deslogin 3031/tcp open  epic   When I tried telnet [my.domain.ip] 443 remotely  Trying &lt;my.domain.ip&gt;... telnet: connect to address &lt;my.domain.ip&gt;: Connection refused telnet: Unable to connect to remote host   Lastly, I do not know if nginx.conf plays a part but below is a snippet of the code for the ssl for the domain  #include /etc/nginx/conf.d/*.conf;  server {     listen          &lt;my.domain.ip&gt;:80;     server_name     mydomain.com www.mydomain.com;     index           index.html index.htm index.py;     access_log      /var/log/nginx/mydomain.com.log;     error_log       /var/log/nginx/mydomain.log.error;     root            /home/fr/;     charset         utf-8;      #error_page 500 502 503 504 /custom_50x.html;     #location = /custom_50x.html {     #        internal;     #}      location / {         uwsgi_pass  &lt;my.domain.ip&gt;:3031;         include     uwsgi_params;     }      location /static {         root        /home/fr/env/FRuler/fruler/;     } }  ### for ssl  ### server {     listen          &lt;my.domain.ip&gt;:80;     server_name     mydomain.com www.mydomain.com;     index           index.html index.htm index.py;     access_log      /var/log/nginx/mydomain.com.log;     error_log       /var/log/nginx/mydomain.log.error;     root            /home/fr/;     charset         utf-8;       location / {         uwsgi_pass  &lt;my.domain.ip&gt;:3031;         include     uwsgi_params;     }      location /static {         root        /home/fr/env/FRuler/fruler/;     } }  server {     listen 443 ssl;     server_name     mydomain.com www.mydomain.com;     ssl on;     ssl_certificate /etc/ssl/mydomain/ssl.crt;     ssl_certificate_key /etc/ssl/mydomain/server.key;     server_name mydomain www.mydomain.com;     access_log  /var/log/nginx/mydomain.com.log;     error_log   /var/log/nginx/mydomain.log.error;     location / {         root /home/fr/;         index index.html;     } } ### end of ssl ###   Any help is appreciated.
9423
I have just discovered this feature.   Declaring an interface using the "@interface" syntax allows you to put a default value.  public @interface HelloWorld {       public String sayHello() default "hello world"; }   This is something new for me. How is that default value suppose to be used.  I cannot find references to that, because the www is full of java interface documents prior to "@" addition in Java 1.5 ( was it on .5 or in .4? )     EDIT  Thanks for the answers ( I was somehow close to "annotation", for I use the tag already )  :P   I knew I should've read that document years ago!!!... let's see...      Many APIs require a fair amount of boilerplate code. For....
8707
The socket API is the de-facto standard for TCP/IP and UDP/IP communications (that is, networking code as we know it). However, one of its core functions, accept() is a bit magical.  To borrow a semi-formal definition:     accept() is used on the server side.   It accepts a received incoming attempt   to create a new TCP connection from   the remote client, and creates a new   socket associated with the socket   address pair of this connection.   In other words, accept returns a new socket through which the server can communicate with the newly connected client. The old socket (on which accept was called) stays open, on the same port, listening for new connections.  How does accept work? How is it implemented? There's a lot of confusion on this topic. Many people claim accept opens a new port and you communicate with the client through it. But this obviously isn't true, as no new port is opened. You actually can communicate through the same port with different clients, but how? When several threads call recv on the same port, how does the data know where to go?  I guess it's something along the lines of the client's address being associated with a socket descriptor, and whenever data comes through recv it's routed to the correct socket, but I'm not sure.  It'd be great to get a thorough explanation of the inner-workings of this mechanism.
81142
I have a object that is my in memory state of the program and also have some other worker functions that I pass the object to to modify the state. I have been passing it by ref to the worker functions. However I came across the following function.  byte[] received_s = new byte[2048]; IPEndPoint tmpIpEndPoint = new IPEndPoint(IPAddress.Any, UdpPort_msg); EndPoint remoteEP = (tmpIpEndPoint);  int sz = soUdp_msg.ReceiveFrom(received_s, ref remoteEP);    It confuses me because both received_s and remoteEP are returning stuff from the function. Why does remoteEP need a ref and received_s does not?  I am also a c programmer so I am having a problem getting pointers out of my head.  Edit: It looks like that objects in C# are pointers to the object under the hood. So when you pass an object to a function you can then modify the object contents through the pointer and the only thing passed to the function is the pointer to the object so the object itself is not being copied.  You use ref or out if you want to be able to switch out or create a new object in the function which is like a double pointer.
15043
When I implement an RMI server (implement an interface that extends java.rmi.Remote) is there a way to get information about the current RMI request context, specifically the remote client's IP address?  public void myMethod() throws RemoteException {      log.info("remote IP is "+ RMISomething.getSomething());  }
73072
I'm building a chat server with .NET. I have tried opening about 2000 client connections and my Linksys WRT54GL router (with tomato firmware) drops dead each time. The same thing happens when I have several connections open on my Azureus bit-torrent client.  I have three questions:   Is there a limit on the number of open sockets I can have in Windows Server 2003? Is the Linksys router the problem? If so is there better hardware recommended? Is there a way to possibly share sockets so that I can handle more open client connections with fewer resources?
59767
I am setting up a new server with 18.04 based on instructions written for 14.04. I have got as far as these steps:  /sbin/iptables -A FORWARD -p tcp --destination-port 80 -j ACCEPT /sbin/iptables -t nat -A PREROUTING -j REDIRECT -p tcp --destination-port 80 --to-ports 8080 /sbin/iptables-save # To save permanently (reset-persistent): sudo sh -c "iptables-save &gt; /etc/iptables.rules" # Modify in /etc/network/interfaces # Add this line:     pre-up iptables-restore &lt; /etc/iptables.rules     # As below:  # The loopback network interface auto lo iface lo inet loopback     pre-up iptables-restore &lt; /etc/iptables.rules  # The primary network interface auto eth0 eth1 iface eth0 inet static         address XXX.XXX.XX.XXX         netmask 255.255.255.0         gateway XXX.XXX.XX.1         dns-nameservers 8.8.4.4 8.8.8.8 XXX.XXX.0.3 iface eth1 inet static         address XX.XXX.67.47         netmask 255.255.0.0   But it turns out that 18.04 does things a different way, using something called netplan.   I have found questions and answers related to how to revert back to how things were done in 14.04, but I am wondering whether it is better to do the same thing the new way.   How can I do what is being done the old way using netplan?
123798
I have had no trouble getting the sockets working with localips, but once I made the code change to use public ips, I've consistently gotten java.net.ConnectException.  I am using the port 8084, which as far as I know, is not used elsewhere In the command prompt, netstat -a | grep 8084 shows: File STDIN:   TCP    user-9114eb19a8:8084    user-9114eb19a8:0      LISTENING  I have gone into my router and ensured that it is open I get my public ip using a request to   Server:  serverSocket = new ServerSocket (8084);   Client:  socket = new Socket (hostaddr, 8084); //hostaddr is a string containing my public-IP //it works when the program is run on a localnetwork and I am using my local-ips
36067
I set up two asterisk servers (on Fedora) in different networks. My goal is to make a call from softphone (on windows lite with ip: 192.168.20.3) to the asterisk server 2 which is in the other network (ip:192.168.10.2).   But the problem is in registration between the two asterisk servers which are behind NAT.  NAT IP for Asterisk Server 1: 100.100.100.100 NAT IP for Asterisk Server 2: 200.200.200.200     Architecture:        IAX.conf in Asterisk server 1:   [general] autokill=yes externip=100.100.100.100 localnet=192.168.10.0/255.255.255.0 nat=yes register =&gt; zone1:welcome@200.200.200.200  [zone2] type=friend host=200.200.200.200 trunk=yes nat=yes qualify=yes secret=welcome context=incoming_zone2 permit=0.0.0.0/0.0.0.0      IAX.conf in Asterisk server 2:   [general] externip=200.200.200.200 localnet=192.168.20.0/255.255.255.0 nat=yes autokill=yes register =&gt; zone1:welcome@100.100.100.100  [zone1] type=friend host=100.100.100.100 trunk=yes nat=yes qualify=yes secret=welcome context=incoming_zone1 permit=0.0.0.0/0.0.0.0      extensions.conf in Asterisk server 1   [general] autofallthrough=yes  [phones] include =&gt; internal include =&gt; remote  [internal] exten =&gt; _5XXX,1,NoOp() exten =&gt; _5XXX,n,Playback(hello-world) exten =&gt; _5XXX,n,Dial(SIP/${EXTEN}) exten =&gt; _5XXX,n,Hangup()  [remote] exten =&gt; _6XXX,1,NoOp() exten =&gt; _6XXX,n,Playback(hello-world) exten =&gt; _6XXX,n,Dial(IAX2/zone2/${EXTEN}) exten =&gt; _6XXX,n,Hangup()  [incoming_zone2] include =&gt; internal      extensions.conf in Asterisk server 2   [general] autofallthrough=yes  [phones] include =&gt; internal include =&gt; remote  [internal] exten =&gt; _6XXX,1,NoOp() exten =&gt; _6XXX,n,Playback(hello-world) exten =&gt; _6XXX,n,Dial(SIP/${EXTEN}) exten =&gt; _6XXX,n,Hangup()  [remote] exten =&gt; _5XXX,1,NoOp() exten =&gt; _5XXX,n,Playback(hello-world) exten =&gt; _5XXX,n,Dial(IAX2/zone1/${EXTEN}) exten =&gt; _5XXX,n,Hangup()  [incoming_zone1] include =&gt; internal      Registration state: Rejected     NOTES:   PING between the two networks is ok  Firewall on servers was turned off
43060
I have a problem in which I cannot access a server using its public name from the same network as the server. Access to the server works fine from the internet.  Reading up on this problem, I've ran across such things as hairpin NAT, loopback NAT, split DNS, editing hosts files, etc.  My network has a SMC 8013WG-CCR (Comcast) cable modem connected to a Linksys WRT54G2. As I understand, the router is supposed to handle this sort of loopback (by leaving the security option "Filter Internet NAT Redirection" disabled), but the connection between these two devices is a secondary LAN, so I don't think the router "knows" what the proper public IP address is.  The easiest solution would be to edit the hosts files of all the computers in the network, but many are notebook computers which will need to access the server both on the LAN and externally.  The server is Windows Server 2012, so I could set it up as the internal DNS server but I don't have enough experience with this to really understand how it would interact with the router, DHCP, etc.  I am prepared to purchase a new router if I need something with greater capability. It appears from my research that most IT admins prefer to solve this problem with split DNS rather than hairpin NAT. I understand the concept of hairpin NAT more clearly than split DNS. It seems to me that the router just needs to provide LAN clients with the local IP of the server when clients use the public name (sub.domain.com). Isn't that just an entry in a local DNS cache? Is that what split DNS does?  What would be a good solution to implement this fix for a small business?
11928
When I am online, I get following error and the tool does not start:  [root@dhcppc9 lin64]# ./ise No protocol specified _pn: cannot connect to X server :0.0   But everything is OK when I am not a superuser. Why that?  Edit  [root@dhcppc9 lin64]# export $(dbus-launch) No protocol specified   any suggestion?  Also   [root@dhcppc9 lin64]# xhost [+] No protocol specified xhost:  unable to open display ":0.0"
3700
How hard can this be? I want to get the current CPU performance from a remote Win 2k3 machine. I need to use SNMP because the machine is behind a firewall.  Assumptions:   I understand networking/can configure any kind of IP address/port forwarding/firewall/stuff. I understand SNMP - I know how to use my tool to get a value from an OID on a target machine.  I know what I want to do with the result from my SNMP request. I have enabled SNMP on the Windows Server, configured the relevant IP security/community stuff. I can already ask the Windows server standard stuff using SNMP about how many disks/network interfaces it has etc.   Question: - What OID do I used to simply ask current performance usage.  I have spent many hours asking Google - clearly asking the wrong question :S .... How hard can this be?
77310
My company has purchased a product that renders an ASP.NET control on the page. This control uses jQuery 1.2.3 and adds a script tag to the page to reference it. The developers of the control will not support use of the control if it modified in any way (including modification to reference a different version of jQuery).  I'm about to start development of my own control and would like to use the features and speed improvements of jQuery 1.3. Both of these controls will need to exist on the same page.  How can I allow the purchased control to use jQuery 1.2.3 and new custom development to use jQuery 1.3? Also out of curiosity, what if we were to use an additional control that needed to reference yet another version of jQuery?