C# Sockets

Discussion in 'Software' started by mastermosley, Jan 1, 2008.

  1. mastermosley

    mastermosley Sergeant

    I'm just trying to create a socket via the following code but it keeps telling me that I "Cannot implicitly convert type 'System.Net.Sockets' to int.

    Code:
    public void Socket_Create
    {
            int sock = new Socket
            (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
    
            if  (sock == -1)
            {
                    //Socket Creation Failed
            }
            //Socket Creation Succesfull
    }
    
    what am I doing wrong
     
  2. Kodo

    Kodo SNATCHSQUATCH

  3. Wookie

    Wookie Sergeant Major

    If this were Java you would be checking that the object were not null or that the bytes returned by a stream was correct, I have a feeling its the same for C#
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds