error CS1022: Type or namespace definition, or end-of-file expected

im creating a messaging application for andriod/ios, but i am completely new to c# and networking, ive followed the first steps of a simple socket tutorial to get me started in networking (https://www.youtube.com/watch?v=KxdOOk6d_I0) but i get the error error “CS1022: Type or namespace definition, or end-of-file expected”.

im assuming that it has something to do with namespace because im new and dont even understand what it does, and my compiler says there are no errors (im using visual studio code if that makes a difference) but it may be something else.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net.Sockets;  namespace server_test {     class program     {         static void main(string[] args)         {              IPAdress ip = Dns.GetHostEntry("localhost").AdressList[0];             TcpListener server = new TcpListener(ip, 8080);             TcpClient client = default(TcpClient);              try             {                 server.Start();                 Console.WriteLine("server started...");                 Console.ReadLine();             }catch (Exception ex)             {                 Console.WriteLine(ex.ToString());                 Console.ReadLine();             }          }     } } 

it should say server started…” or throw up an exeption but this is what im getting every time:

[Running] mono “C:\Users\Aidan\AppData\Roaming\Code\User\cs-script.user\cscs.exe” “d:!computer science!!NEA!\test stuff\networking\server_test\program.cs” Error: Specified file could not be compiled.

csscript.CompilerException: d:!computer science!!NEA!\test stuff\networking\server_test\program.cs(7,127): error CS1513: } expected d:!computer science!!NEA!\test stuff\networking\server_test\program.cs(37,1): error CS1022: Type or namespace definition, or end-of-file expected

at csscript.CSExecutor.ProcessCompilingResult (System.CodeDom.Compiler.CompilerResults results, System.CodeDom.Compiler.CompilerParameters compilerParams, CSScriptLibrary.ScriptParser parser, System.String scriptFileName, System.String assemblyFileName, System.String[] additionalDependencies) [0x00102] in :0 at csscript.CSExecutor.Compile (System.String scriptFileName) [0x0080d] in :0 at csscript.CSExecutor.ExecuteImpl () [0x005a1] in :0

[Done] exited with code=1 in 1.795 seconds