As you're using Response.Write, I assume this is a web site. You should tag your questions properly. You should also read up on how ASP.NET works and perhaps learn to use a debugger. The error means what it says, and it is right. Even though you didn't tell us what line creates the error, it's obvious.
comm = new GsmCommMain(int.Parse(txtPort.Text), 3600, 360);
comm.Open();
Response.Write("port baglandi");
This is well and good.
pdu = new SmsSubmitPdu("test", "05452756736");
comm.Open();
comm.SendMessage(pdu);
comm.Close();
Response.Write("mesaj gonderildi");
Here, comm is null, because it's a new postback and the web is stateless, your page gets recreated on each postback and can't remember the variables you created last time. You need to not have a 'connect' step, the samples you're looking at, assume this is not a web app.