Muti-User TCP Send/Receive Sample

Does anyone have a link to a video tut for showing how to do a Multi-User TCP Send/Receive Sample? I know there is a drag and drop tool you can use but Im interested in making it by hand to better understand how to program it my self. At some point I want
to use this information to make a simple game that sends and receives data packets between two machines for a simple "fighting" game.

conceptually, simple network programming is pretty easy. here is a excerpt from a prior post that may help you getstarted
ok, there are a few fundamentals to cover.
1) a network communication consists of:
a server program listening on one of the server's ports (in this context port and socket are synonymous).
a network path from client port to server port (I mention ports, because firewalls often filter on them, breaking the path).
a client application sending data to a local socket
a common  data format that both the client and server will use.
2) the network acts as an intermediary to pass data between systems, but the data itself is system agnostic, so theres not really such a thing a java data. just data that was put in a format/encoding by whatever language.
so your question has two parts:
1) how to send to a server socket.
2) how to format the data so that the server understands it.
In terms of sending and receiving data, the system.net.sockets library is what you want, though Cor recommends using wcf. I've not worked with it, but here is a sample I worked up while exploring the http protocol:
Module Module1
Sub Main()
Dim req As String = "GET / HTTP/1.1" & ControlChars.CrLf & ControlChars.CrLf
Using sock As New Sockets.TcpClient()
Try
Console.WriteLine("Connecting...")
sock.Connect("www.google.com", 80)
If sock.Connected Then
Console.WriteLine("Connected. Sending request...")
Dim ns As Sockets.NetworkStream = sock.GetStream()
Console.WriteLine(ReadResponse(ns))
Dim sendBytes As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(req)
If ns.CanWrite Then
ns.Write(sendBytes, 0, sendBytes.Length)
Threading.Thread.Sleep(5000)
Else
Console.WriteLine("Stream not writable")
End If
Console.WriteLine(ReadResponse(ns))
Else
Console.WriteLine("Failed to connect")
End If
Catch ex As Exception
Console.WriteLine(ex.Message & vbNewLine & ex.StackTrace)
End Try
sock.Close()
Console.WriteLine("Press Enter to exit")
Console.ReadLine()
End Using
End Sub
Public Function ReadResponse(ByVal ns As Sockets.NetworkStream) As String
Dim ret As String = "Response: "
Dim resp As String = ""
If ns.CanRead And ns.DataAvailable Then
Using sr As New IO.StreamReader(ns)
While sr.Peek <> -1
resp &= vbNewLine & sr.ReadLine()
End While
End Using
End If
Return ret & resp
End Function
End Module
it sends the data "GET / HTTP/1.1" to google, and reads the response. its just throwaway code, but should give you a good example.
so, for a p2p IM application, I would have two sockets per client, one listening for incoming messages, and one sending to the remote box's listening port.
once you have your sockets established its primarily reading and writing to the network stream that the connected sockets provide.
Look it over and see if that doesn't help address some of your conceptual questions.
Edit:
 as others have pointed out down the thread, this is far from perfect implementation, so if you are not in the us or on a slow connection, results may vary. seee below for details.

Similar Messages

  • Limiting an email user's send/receive abilities

    We're running Mac OS X Server 10.4.7 on our mail server. Everything is running great.
    What I want to know is if it's possible to set up a special email account (like [email protected]) that can access webmail to communicate with specific @myschool.com addresses (and no others), but cannot talk to the outside world. But I need to make sure all other email accounts continue to work like regular old email accounts that can talk to anyone.
    For example, [email protected] can only send/receive messages to/from [email protected], the math teacher's email address. But [email protected] can send/receive messages to/from anyone. This would be very handy for us.

    Doing so will cause issues. If you send out mail which to an outside server appears to be non existent, mail may be rejected and you may even be blacklisted.
    You can remove the account from WGM and add a role account as an alias send to /dev/null. This will look to the outside world like an existing address, but simply be discarded on your system. You should however include a working address in your mailings for people to be able to respond.
    Assuming you use local domains, edit /etc/postfix/aliases and add:
    noreply: /dev/null
    (you can change noreply with the sender used in your PHP apps, but I'd probably change the PHP apps to use noreply as this signals to people receiving your mails that this address is unattended).
    When done, issue:
    sudo postalias /etc/postfix/aliases
    sudo newaliases
    sudo postfix reload
    HTH,
    Alex

  • Exchange 2010 max send receive size

    Hi All,
    Would someone be able to help me with a ps command to remove the message size restrictions from all user mailbox properties? We ran into a problem a while ago and opened a support call with MS regarding a user trying to send a 1.7GB file. Well exchange didn't
    like that so we let MS have their way with our environment and now all users have a user 10MB send/receive limit. This has been confirmed by going into the user properties > mail flow settings tab > message size restrictions. We have the global setting
    at 25MB along with the send/receive connector settings at 25MB but with the individual user limits at 10MB there is no point.
    I have run and tested the following PS cmdlet
    set-mailbox -Identity "user" -MaxSendSize 15mb -maxreceivesize 16mb
    to run against an individual user mailbox but we have close to 22000 mailboxes and this would take forever to do one at a time. Is there a cmdlet I could run to remove these restrictions altogether all at once?
    Thanks in advance

    Hi Martina,
    Thanks for the reply, being quite new to using Powershell I think I get the piped command but could you tell me what the -Resultsize unlimited part fetches?
    If you don't include the resultsize unlimited, it will only pull down the first 1000 mailboxes in your query.
    Twitter!: Please Note: My Posts are provided “AS IS” without warranty of any kind, either expressed or implied.

  • RE: (forte-users) send/receive mail

    Hi Nat,
    you have three possibilities to integrate MAPI to a Forte program:
    1. using mapi32.dll (simple MAPI) or mapix32.dll (MAPI). You must integrate
    this libraries using a C wrapper class (as described in "Integrating with
    External Systems").
    2. using OLE Active messaging library ( as described in 'Integrating with
    Windows and Macintosh")
    3. or implement POP3 using an ExternalConnection class.
    Regards,
    Zenon Adamek
    Forte Developer
    Purolator Courier Ltd.
    ZAdamekpurolator.com
    -----Original Message-----
    From: Nat Balasubramaniam [SMTP:NBalasubdcjs.state.ny.us]
    Sent: Wednesday, January 26, 2000 2:18 PM
    To: Forte-userssagesoln.com
    Subject: (forte-users) send/receive mail
    Our application needs to send/receive mails from a mail server in NT
    environment. Does forte provide SMTP and POP3 protocol support(libraries)
    so that we can use external connection class to connect to the server and
    send/
    receive mails or do we have to use third party controls. Any help would be
    appreciated.
    For the archives, go to: <a href="http://lists.xpedior.com/forte-users">http://lists.xpedior.com/forte-users</a> and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

    Hi,
    Unfortunatly, Forte does not provide SMTP and POP3 protocoles.
    But, you can use External connections to do it if you need.
    You can find a simple SMTP send mail sample code on
    http://perso.club-internet.fr/dnguyen/ . The receive should be as easy as the send.
    For MIME base 64 encoding and decoding, it should last one or two weeks of coding
    (if you need optimization).
    One advantage of coding this in Tool directly is the portability.
    In your case, on NT, you could also interface with MAPI using for instance the
    ActiveX interface.
    By that way, you will already have SMTP, POP3 and MIME.
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    http://perso.club-internet.fr/dnguyen/
    edwardsmjwillis.com a &eacute;crit:
    Hi,
    Our Forte development team are currently investigating how we can add internet
    mail capabilities to a Forte application. Our application needs to send/receive
    mails from a mail server in an NT environment. Does forte provide SMTP and POP3
    protocol support (libraries) so that we can use external connection class to
    connect to the server and send/ receive mails or do we have to use third party
    controls ?.
    Any help regarding code examples or third party solutions would be appreciated.
    Thanks in advance
    Mark J Edwards
    Senior Technical Specialist
    Willis
    Email: edwardsmjwillis.com
    The information in this email and in any attachments is confidential and may be
    privileged. If you are not the intended recipient, please destroy this message,
    delete any copies held on your systems and notify the sender immediately. You
    should not retain, copy or use this email for any purpose, nor disclose all or
    any part of its content to any other person.
    For the archives, go to: http://lists.xpedior.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com

  • I can call out but all incoming calls are going directly to VM with no signal that I missed a call or have VM. I can send/receive text messages from other iPhone/iPad/iTouch users, I am assuming this is really "iMessage." Is it apple software?

    I have spent hours on the phone with Apple and AT&T. I went thought reset, on/off, etc, etc with both companies to no avail. Each company pointed fingers at the other....as being the source of the problem.
    Problems: Suddenly ALL  incoming calls were going directly to VM with no signal I missed calls and/or had VM. I was also unable to receive all Text Messages...Oddly, I could send text messages to anyone (even non-apple users but I could not receive their responses)........then I when I got home I started receiving text messages from other apples users ONLY. I assume now - iMessage kicked in and I could text (send/receive)  other iPhone/iPad/iTouch users ONLY. ....yes, I could still (send) text messages to my husband's blackberry (he received my messages fine) but my phone would NOT receive his text respones.
    Finally, I googled the problem and found this community where other people have had the exact same problems! One person said he "turned off 3 G" which was the solution for him....so I did the same and VIOLA! My problem  solved! Nevermind the fact that I pay for 3G and cannot use it....so here's my question, if 3G is the problem on my phone is this an APPLE issue or a NETWORK problem? Do I purchase a new phone and slip in my same SIM card and hope the same does not occur or do I get a whole new SIM card and phone? What is the long term resolution to this problem?
    I am happy however to find that my problem is NOT an isolated incident and wish Apple or AT&T had told me this is not so uncommon because I thought (based on the baffled response from Apple) that this has never occurred before.  Where is Steve Jobs when we need him?

        jsavage9621,
    It pains me to hear about your experience with the Home Phone Connect.  This device usually works seamlessly and is a great alternative to a landline phone.  It sounds like we've done our fair share of work on your account here.  I'm going to go ahead and send you a Private Message so that we can access your account and review any open tickets for you.  I look forward to speaking with you.
    TrevorC_VZW
    Follow us on Twitter @VZWSupport

  • Slow email send/receive for user associated with beehiveonline

    It takes hours to send/receive an email to/from the user associated with my beehiveonline workspace. Also, the number of emails that we receive has decreased, it may be not related at all, but there is no way for me to check if that's just due to low customer activity or to timeouts.

    Hi,
    If you have issues then let us know the date/time of the issue and the degree of delay you are seeeing and we can check if there may be a reason for the delay.
    Phil

  • User can send but not receive emails

    Hello!
    So I've just set up a band new server from scratch and am having trouble getting the email service to work 100%.
    My dns is all correct, forward and reverse. The output of a changeip -checkhostname command is perfect. My domain name and its public ip address both point to each other fine and my A, MX and CNAME records have all been set at the domain vendor to point to my particular server.
    I've made one user in WGM and that user can send emails no problem. But when I try to send an email back (or reply to the original message), this is the error I receive in the bounce message:
    <[email protected]>: Host or domain name not found. Name service error
    for name=server.jinniferules.com type=A: Host not found
    Reporting-MTA: dns; server.example.com
    X-Postfix-Queue-ID: 75E7A223CE8
    X-Postfix-Sender: rfc822; [email protected]
    Arrival-Date: Wed, 12 Jan 2011 11:15:20 -0700 (MST)
    Final-Recipient: rfc822; [email protected]
    Original-Recipient: rfc822;[email protected]
    Action: failed
    Status: 5.4.4
    Diagnostic-Code: X-Postfix; Host or domain name not found. Name service error
    for name=server.jinniferules.com type=A: Host not found
    Any thoughts on this?
    Thanks!
    Message was edited by: jinniferb

    Solved my own problem: what was needed was to add a "server" entry to the A-records list that pointed to the IP.
    Sheesh! Haha.

  • Creat a Dashboard - A Particular User/User Group mails send/receive Statstics - is it possible ? How ? Exchagen 2013 Scom 2012 R2

    I want to see a particular user mailbox statistics for its send receive count in particular hours of the day
    Is there a way to build such a dashboard in SCOM 2012 R2 for Exchange 2013 ?
    Please help.
     

    Hi,
    The follwing article may be helpful
    Monitoring Exchange 2013 with SCOM 2012
    http://www.msexchange.org/articles-tutorials/exchange-server-2013/monitoring-operations/monitoring-exchange-2013-scom-2012-part1.html
    Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Users can't send/receive, but are connected to Exchange Server

    Greetings,
    For some reason (happened this morning), none of my users (who are a mixture of Outlook 2010 PC and Outlook 2011 Mac) can send/receive email as quickly as usual (if at all).  Exchange server is 2010.
    Both clients are connected to the Exchange server successfully.  Sending an email usually takes (if it even goes at all) 10-20 minutes.  If I send an email from my Gmail account, again it take about 20 minutes to finally get to Outlook.
    Exchange server is not running any virus software.  On my Outlook client for instance (2010 PC), it's stuck on Updating Inbox indefinitely.
    No changes have been made to the LAN (and no other servers are having connection issues) or WAN.  I have run performance troubleshooting on the Exchange server, and all seems fine.  I have checked event viewer on both the Exchange server as well
    as the DC and DNS server (they are one and the same).  I've rebooted the DC, DNS and Exchange servers.
    Arrrrggggg!!  
    Thanks in advance for any advice.

    Hi,
    According to your description, both your Exchange accounts and Gmail account have the mail delay issue.
    Thus, I'd like to confirm the following information to narrow down the cause:
    1. Do your external users also come across the issue? Because this may be related to Network issue.
    2. Does the issue happens randomly or regularly?
    And I also recommend you use Performance Monitor to check the issue as Ed said.
    If you have any question, please feel free to let me know.
    Thanks,
    Angela Shi
    TechNet Community Support

  • CPU time sending/receiving with TCP

    Hello all,
    I need to know how long it takes in the CPU to have the OS establish a TCP connection against another machine, and also to send/received TCP packets to/from that machine.
    Say it's Solaris 9 and any CPU you are familiar with as an example (Intel, Sparc...)
    Thank you in advance

    In the end I found a IEEE report where they tested Solaris 8 on Pentium 500 MHz. In a few words and ideally, it seems that TCP connections were allocated in around 0.6 ms during that test.

  • On my iPhone 5 I am having a problem sending / receiving e-mails and am receiving the message: the user name or password for "imap.gmail" is incorrect. Despite many attempts I am getting nowhere. Does anyone recognise this problem?

    I am having a problem sending/receiving e mail messages on my iPhone 5 and cannot access my account. The message I am receiving is: The user name or password for "imap.gmail" is incorrect.
    I do not know what imap.gmail is. I have also lost data which was contained on my diary which I believe is linked to the problem. Does anyone recognise this problem?
    Cheers,
    Morred

    Morred wrote:
    I am having a problem sending/receiving e mail messages on my iPhone 5 and cannot access my account. The message I am receiving is: The user name or password for "imap.gmail" is incorrect.
    I do not know what imap.gmail is. I have also lost data which was contained on my diary which I believe is linked to the problem. Does anyone recognise this problem?
    Cheers,
    Morred
    imap.gmail is the Google mail server. It doesn't recognize the password that is stored in the iPhone. The problem is that the password or email address you have in Settings for the gmail account is wrong. If you changed the password somewhere else that is the reason. You need to go to Settings/Mail,Contacts,Calendar, tap on the gmail account and enter the correct password. You also need to change it for outgoing mail in Settings.

  • I cannot send or receive text messages from other iPhone users. I don't get an error I just don't receive any messages and the other users do not receive mine.

    I cannot send or receive text messages from other iPhone users. I don't get an error I just don't receive any messages and the other users do not receive mine.

    Reset the devices: Hold down the home button along with the sleep/wake button until you see the apple, then let go.

  • How to configured different AD sites mailbox user able to send & receive mail to each other?

    I have 2 system in one system i configured DC=Yahoo.com + Xchange07 & on 2nd sytem i configured DC=Google.com + Xchange 07 successfully configured (in VMware)
    I already made entry of Both DC's DNS entry of New Host record & NewMail Exchanger (MX)
    both DC ping each other with DC name i.e. yahoo.com DC ping to google.com & vice-versa.
    Same AD site mailbox user able to send & receive mail but google.com mailbox user can't send & receive mail from yahoo.com as vice-versa.

    Hi,
    I recommend you check if you can telnet the other CAS/HT server on port 25 from each side.
    If it connects, is there any error message or NDR when sending or receiving email from each other?
    If it fails, please check if port 25 is open. If you have a firewall enabled, please make sure that port 25 is open. Besides, please check whether the DNS records have been configured correctly.
    Best regards,
    Belinda
    Belinda Ma
    TechNet Community Support

  • Cannot receive any calls, can only send/receive texts if iphone users/verizon users-any suggestions?

    recently ported to Verizon, I cannot send/receive texts to non iphone/verizon users and cannot receive phone calls at all.  I turned off imessaging and checked my old service was deactivated-any suggestions? 
    http://www.pinterest.com/pin/create/extension/

        slave26,
    Thank you for joining Verizon Wireless! I want to ensure that your port was successful and we get your phone working. I have sent you a direct message here. Please review your inbox and reply to my message from "AndreaS_VZW."
    AndreaS_VZW
    Follow us on Twitter @VZWSupport

  • Imessages not sending/ receiving.  All texts made to other iphone users produce an error message where it shows as it was unable to deliver, however, the messages go through, but error still comes up after each imessage sent.  this does this for each text

    I have the Iphone 5S.  Over the last few days, I continually get mail delivery errors when imessages are sent to any contacts who have iphones.  I have spoken to my friends/ family who are also on the receiving/ sending end of my messages.  They also say that they are receiving an error/ mail delivery error when they send imessages to my phone.  Text messages are working fine (with other phones that are not iphones) and no delivery errors come up.  However, it is just with me sending or receiving imessages.  I have gone in to settings> messages> send & receive and all my information is right.  I have also attempted to cut the phone off and back on (hard reset as well) and this has not fixed the problem.  I then explored to see if my software was out of date, however, i have the most up to date software for the iphone 5 S.  Does anyone know of a way to fix this problem, as it is annoying to both me and anyone else who has an iphone that sends me a text/ imessage as it will *alert* that there was a delivery failure.
    Please help!!

    There could be a problem with iMessage, although usually when there is an outage these boards are flooded with problems.    It could be a very isolated issue, and if just started all of a sudden, it might be something at Apple.
    Although it is annoying, I would just wait it out a few days and see if it goes away on its own.

Maybe you are looking for